for loop for variables
1 view (last 30 days)
Show older comments
can anybody tell how can run this code. I wan to find volume varition that depenf on Xd and Xp
q=1.4
Ad=1.9625*10^-3;
Ap=9.4985*10^-5;
kd=3985;
md=0.0023;
wd=((2*9.81)/0.140)^0.5;
wp=(kd/md)^0.5;
Sd=0.004;
Sp=0.003;
Xd=0.04;
Xp=1;
0=90;
for t=0:100
xd(t)=Xd*sin(wd*t);
xp(t)=Xp*sin(wp*t-o);
v1=Ad*Sd-Ad*xd(t);
v11=(Ad-Abd)*Sd+Sp*Ap+(Ad-Abd)*xd(t)-Ap*xp(t);
end
0 Comments
Accepted Answer
Alan Stevens
on 23 Nov 2020
You probably want o = 90; not 0 = 90;
Also, Matlab indexing starts at 1 not zero, so, perhaps, t = 1:101, then xd(t) = sin(wd*(t-1)); etc.
To save all values of v1 you want v1(t) = ... Similarly for v11
You also need to define Abd.
0 Comments
More Answers (1)
See Also
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!