can not get values
显示 更早的评论
i built this mathimaticly project of tram running simulation , but there is no error and at the same time there is no output values (all values are zero), would u please help me and diagnose the matter ?
采纳的回答
更多回答(1 个)
Mark Sherstan
2019-1-29
Your data set and interplation dont line up. The R variable you define is:
R =
379 24
1000 56
1180 110
1300 72
2360 1170
2990 328
6200 154
6320 192
9149 283
Looking at the first couple loops t will be 1, 2, 3, ...
interp1(R(:,1),R(:,2),t)
t has nothing to interpolate to. It is not bounded by any values and will output "nan" which forces your if statment:
if interp1(R(:,1),R(:,2),t)>0
R=interpl(R(:,1),R(:,2),t);
wR=600*m*g/(R-55);
else
wR=0;
end
To output a zero answer. Try fixing up your data sets and solve the first couple itterations by hand to make sure everything makes sense.
类别
在 帮助中心 和 File Exchange 中查找有关 MATLAB 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!