Effacer les filtres
Effacer les filtres

not enough input arguments( not what you think)

1 vue (au cours des 30 derniers jours)
Netanel Malihi
Netanel Malihi le 16 Nov 2021
Commenté : Netanel Malihi le 16 Nov 2021
the function gets only one argument but it says not enough arguments ,
also its says x=x0 in line 6 but this specific data is not in line 6
what could be the problem?
function X_coordinate = beam(x0)
epsilon = 1e-4;
flag = 0;
counter = 0;
q0 = 0.5
L = 1000
I = 351*10^6
VIn = -0.5972
E = 100
x = x0;
while flag == 0
%Check for infinite loop
counter = counter + 1
if counter > 10000;
error('Too many iterations');
end
v = -(q0*L)/(3*pi^4*E*I)*(48*L^3*cos((pi*x)/(2*L))-48*L^3+3*pi^3*L*x^2-pi^3*x^3)
v_d = -(q0*L)/(3*pi^4*E*I)*(-48*L^3*(pi/(2*L))*sin((pi*x)/(2*L))+6*pi^3*L*x-3*pi^3*x^2)
x = x-v/v_d %solution
if abs(v/v_d) < epsilon || abs(v) < epsilon
flag = 1;
end
end
X_coordinate = x;
if X_coordinate <=0
error('No solution found,Please enter valid value')
else
X_coordinate = x
end

Réponses (2)

the cyclist
the cyclist le 16 Nov 2021
Modifié(e) : the cyclist le 16 Nov 2021
How are you calling this function?
I put your function in a file named beam.m, then called it from the Command Window using
beam(1)
and the code ran just fine.
If I try to call it as
beam() % call without required input
then I get the error message:
Not enough input arguments.
Error in beam (line 11)
x = x0;
  2 commentaires
Netanel Malihi
Netanel Malihi le 16 Nov 2021
i call it beam(500) and get not enough input arguments and also the i get the same error x=x0 but in line 6
how could it be ?
Netanel Malihi
Netanel Malihi le 16 Nov 2021
thanks

Connectez-vous pour commenter.


Jan
Jan le 16 Nov 2021
Modifié(e) : Jan le 16 Nov 2021
"its says x=x0 in line 6 but this specific data is not in line 6"
This means, that you do not call the function you think you are calling. Maybe you did not save the file before calling it or you have multiple files with the same name. Check this by:
which beam -all
You can set a breakpoint in the code you think you are calling. Then you will see, if it is reached at all.

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Tags

Produits


Version

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by