Command prompt says: Not enough input arguments.
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
I want to define a function y and take it's partial derivatives wrt. b,c,d,e and display it's results by plugging in the values of x in it, which are taken as input.
please help me, I am new to Matlab.
but error says :
Not enough input arguments.
Error in pacejka_model_ansh (line 26)
y = f*d*sin(c*atan((b*x) - e*((b*x)) -atan(b*x)));
This is my code:
function [y] = pacejka_model_ansh(d,c,b,e)
m= input('number_of_data_set');
f= input('normal_force');
for i=1:m
fx(i,1)=input('initial_values_fx');
end
for i=1:m
fy(i,1)=input('initial_values_fy');
end
x=linspace (-10 ,0.5 , 10) ;
y = f*d*sin(c*atan((b*x) - e*((b*x)) -atan(b*x)));
y1(x)= diff(y,d);
y2(x)= diff(y,c);
y3(x)= diff(y,e);
y4(x)= diff(y,b);
f1 = zeros(n,1);
f2 = zeros(n,1);
f3 = zeros(n,1);
f4 = zeros(n,1);
for k=1:m
f1(k,1) = y1(fx(k,1));
end
for k=1:m
f2(k,1) = y2(fx(k,1));
end
for k=1:m
f3(k,1) = y3(fx(k,1));
end
for k=1:m
f4(k,1) = y4(fx(k,1));
end
disp (f1);
disp (f2);
disp (f3);
disp (f4);
end
5 comentarios
Adam
el 29 de Jun. de 2017
You use those variables in the line:
y = f*d*sin(c*atan((b*x) - e*((b*x)) -atan(b*x)));
They have to be defined before that. Whether that is from passing them to the function or creating them inside the function they must exist before they can be used.
Function syntax is relatively simple:
function [outputArg1, outputArg2,...] = funcName( inputArg1, inputArg2,...)
The input arguments are the ones you have to give it when you call it (unless you have optional arguments which can be left off), the output arguments you get back and assign to some variables.
If your code uses any of those input arguments then they must be passed in when you call the function. You can define a whole load of spurious input arguments that won't throw an error if your code never actually uses them, but it is pointless.
Respuestas (0)
Ver también
Categorías
Más información sobre Whos en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!