Rotate 2D function

7 ビュー (過去 30 日間)
Alessio Pizziol
Alessio Pizziol 2020 年 4 月 4 日
回答済み: Tommy 2020 年 4 月 4 日
Hi everyone,
I am trying to rotate a function of a certain angle around the origin. I've found something on internet but doesn't work. I put my code so you can see what I'm going to do.
Thanks
figure(1);
Function = 45/4 - (27*x)/2; %My function
fplot(Funciton, '-'); %Plotting my function
hold on
%I've tried this but not work
h = fplot(Funciton, '-');
rotate(h,[0 0],angoli(ii-1));
hold on

回答 (1 件)

Tommy
Tommy 2020 年 4 月 4 日
To rotate by pi/2 radians about the z axis, you can use:
syms x
figure(1);
Function = 45/4 - (27*x)/2; %My function
fplot(x, Function, '-'); %Plotting my function
hold on
syms t
R = [cos(t) -sin(t); sin(t) cos(t)]; % rotation matrix
rotXY = subs(R*[x;Function], t, pi/2);
fplot(rotXY(1), rotXY(2));

カテゴリ

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

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by