for loop for variables
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Alan Stevens
2020-11-23
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 个评论
更多回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!