Hi all, I am actually using Octave, but it is similar to Matlab so I figure I should get it a shoot here. I have a problem while trying to do numerical solution. I got the following error while trying to run the script.
When I tried to remove the ";" I will get the following error.
I also noticed that there is nothing in the workspace. The weird part is that the code works just fine on my friend's Octave. I just copy and paste the code into my computer, but it does not run the script. Can anyone please help?

3 commentaires

KSSV
KSSV le 10 Oct 2018
Copy the code here...not image.....image snippet is not going to hlep any manner for checking.
z = 25;
l = 2500;
L0 = (z^2+l^2)^.5;
ks = 1.35;
EA = 50000000;
F_ext = 200;
v = [0:0.1:70]';
f_ext = EA*(L0-((z-v).^2+l^2).^0.5)/L0.*(z-v)/(((z-vI(i))^2+l^2)^0.5)+ks*v;
plot(v,f_ext); xlabel('v (mm)'); ylabel('f_e_x_t (N)');
vI = 0;
fI_ext = 0;
n = 50;
DF = F_ext/n;
Ki = [];
Dvi = [];
for i = 1 : n
Li = ((z-vI(i))^2+l^2)^0.5;
K = EA/L0 * ( (Li-L0)/Li+((z-vI(i))^2/(Li^2)) + ks;
Dv = K^-1*DF;
vI(i+1) = vI(i)+Dv;
fI_ext(i+1) = fI_ext(i)+DF;
Ki = [Ki;K];
Dvi = [Dvi;Dv];
end
hold on; plot(vI,fI_ext,'o--')
madhan ravi
madhan ravi le 10 Oct 2018
@Daniel check Steven's answer

Connectez-vous pour commenter.

 Réponse acceptée

Steven Lord
Steven Lord le 10 Oct 2018

1 vote

Count your parentheses.

2 commentaires

madhan ravi
madhan ravi le 10 Oct 2018
+1 @steven scrutinised precisely.
z = 25;
l = 2500;
L0 = (z^2+l^2)^.5;
ks = 1.35;
EA = 50000000;
F_ext = 200;
v = [0:0.1:70]';
% f_ext = EA*(L0-((z-v).^2+l^2).^0.5)/L0.*(z-v)/(((z-vI(i))^2+l^2)^0.5)+ks*v; error was here also because you can't subtract scalar with vector
%
% plot(v,f_ext); xlabel('v (mm)'); ylabel('f_e_x_t (N)');
vI = 0;
fI_ext = 0;
n = 50;
DF = F_ext/n;
Ki = [];
Dvi = [];
for i = 1 : n
Li = ((z-vI(i))^2+l^2)^0.5;
K = EA/L0 * ( (Li-L0)/Li+((z-vI(i))^2/(Li^2))) + ks; %error here as steven said one closing parentheses was missing here
Dv = K^-1*DF;
vI(i+1) = vI(i)+Dv;
fI_ext(i+1) = fI_ext(i)+DF;
Ki = [Ki;K];
Dvi = [Dvi;Dv];
end
hold on; plot(vI,fI_ext,'o--')

Connectez-vous pour commenter.

Plus de réponses (1)

Catégories

Produits

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by