Why am I getting "Array indices must be positive or integers values"?
1 回表示 (過去 30 日間)
古いコメントを表示
This is a sine function, which should give me positive and negative values.
syms t
t = 0:0.02:2;
om = 10;
% Steady State Response
up(t)=(100/(400-om^2))*sin(om*t);
plot(t,up(t))
xlabel('Time (sec)')
ylabel('Displacement (in)')
title('Displacement vs Time Response')
Array indices must be positive integers or logical values.
Error in HW5plot (line 6)
up(t)=(100/(400-om^2))*sin(om*t);
0 件のコメント
採用された回答
Star Strider
2020 年 9 月 28 日
Rhe reason is that ‘up(t)’ was being interpreted as an indexing operation rather than a function call, and ‘t’ are not all positive integers. The plot call was also inappropriate.
Try this:
syms t
om = 10;
% Steady State Response
up(t)=(100/(400-om^2))*sin(om*t);
figure
fplot(up, [0 2])
xlabel('Time (sec)')
ylabel('Displacement (in)')
title('Displacement vs Time Response')
.
2 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Number Theory についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!