Command prompt says: Not enough input arguments.
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Adam
le 29 Juin 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.
Réponses (0)
Voir également
Catégories
En savoir plus sur Whos dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!