Index exceeds the number of array elements (20).

1 回表示 (過去 30 日間)
Daniel Martelli
Daniel Martelli 2020 年 8 月 7 日
コメント済み: Daniel Martelli 2020 年 8 月 7 日
A = 4; % centimeters
w = 0.6; % (rad/sec), angular frequency
t = 0:10; % time
x = A*cos(w*t) % time displacement
plot (t',x');
title('Displacement vs Time')
xlable('Time in s')
ylable('Displacement in cm')
Index exceeds the number of array elements (20).
My friends Code
% Plot the dispalcment vs the time
plot(t,x,'Linewidth',2)
title('Displacement vs Time')
xlabel('Time in s')
ylabel('Displacement in cm')
I dont understand why im getting this error, when i have written the same code. The variables are different but the layout is the same. This is my first time using MatLab without the lecturers help and i am stuck. I have tried changing different things but it just doesnt seem to work.
Thanks,
Daniel
  8 件のコメント
KSSV
KSSV 2020 年 8 月 7 日
title is a in built function....so a variable/ function on the name should not be used.
Daniel Martelli
Daniel Martelli 2020 年 8 月 7 日
Oh okay. Thankyou for your help

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by