need to plot value of tau for changing value of angles help

clear % Homework D = diag(-rand(2,1)); % random diagonal matrix of 2 negatives eigenvalues v1 = rand(2,1); v2 = rand(2,1); %v1=v1/norm(v1); %v2=v2/norm(v2); V = [v1, v2]; r1=V(1,:); r2=V(2,:); %V = rand(2,2); % rotation matrix, the angle of rotation is pi/6 for k = 0:0.001:1/3 R = [cos(k*pi), -sin(k*pi); sin(k*pi), cos(k*pi)] k
r11 = r1*R;
r22 = r2*inv(R);
V1 = [r11;r22];
end %V1 = V*R A = V*D*inv(V); D1 = diag(-rand(2,1)); A1 = (V1)*(D1)*inv(V1); figure(1) p = (log(norm(inv(V)*V1)) + log(norm(inv(V1)*V)))/(-max(eig(A)) - max(eig(A1)))
plot(k,p) xlabel('k') ylabel('p')
can u help me to plot this ? the plot shows only a point in space thanks

 採用された回答

ragesh r menon
ragesh r menon 2014 年 4 月 7 日

0 投票

Here you are only storing last values of "k" and "p". And hence the plot shows a point. To modify the code, store value of k first. and the for loop should operate by calling "i". for example
for i=1:length(k)
R(i)=...
r11(i)=..
r22(i)=..
V1(i)=...
end.
this stores each of these values in an array and with these values you can find "p(i)"s. Now if you plot you should be able to meet your requirements

1 件のコメント

Irenee
Irenee 2014 年 4 月 7 日
thanks a lot let me try this. Hope it will work.

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeInteractions, Camera Views, and Lighting についてさらに検索

質問済み:

2014 年 4 月 6 日

コメント済み:

2014 年 4 月 7 日

Community Treasure Hunt

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

Start Hunting!

Translated by