Plotting a position function - Help!

1 回表示 (過去 30 日間)
Seb.W
Seb.W 2013 年 3 月 25 日
I am asked to plot the position function
r(t) = -ti + (t^3)/3)j
over the interval t = -2 < t < 2
where i and j are unit vectors. I've drawn it out by hand but I can't get the same result through Matlab. My problem is that I'm not really sure about how to get those i and j vectors into the expression.
I tried something like
ri = [1;0;0]
rj = [0;1;0]
t = -2:0.1:2
r = -t.*ri + ((1/3)*t.^3).*rj
but got a message saying "Error using . * Matrix dimensions must agree."
Can someone give me some pointers on how to do this.
Many thanks.

回答 (1 件)

Walter Roberson
Walter Roberson 2013 年 3 月 25 日
編集済み: Walter Roberson 2013 年 3 月 25 日
hint:
fx = @(x) sin(x.^2) + cos(x) * 1j;
y = fx(0:.1:1);

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by