Im trying to convert a vector O in radian into x-coordinate vector and y-coordinate vector but Im encountering the problem below.
??? Error using ==> mpower Inputs must be a scalar and a square matrix.
Error in ==> Untitled4 at 22 r=[(a*b)/sqrt((b*cos(O))^2+(a*sin(O))^2)]; % ellipse in polar coordinates
npanels=3;
a=1.25; %major axis
b=0.75; %minor axis
O=[pi-pi/(2*npanels):-pi/(npanels):pi/(2*npanels)]; %boundary points in radian
r=[(a*b)/sqrt((b*cos(O))^2+(a*sin(O))^2)]; % ellipse in polar coordinates
x=rcos(O); %x-coordinate
y=rsin(O); %y-coordinate

 採用された回答

Paulo Silva
Paulo Silva 2011 年 5 月 8 日

1 投票

.^ instead of ^

その他の回答 (2 件)

Walter Roberson
Walter Roberson 2011 年 5 月 8 日

1 投票

r=(a*b)/sqrt((b*cos(O)).^2+(a*sin(O)).^2);
Yoon Hong Ng
Yoon Hong Ng 2011 年 5 月 8 日

0 投票

Now Im having this trouble but i only have 1 matrix
??? Error using ==> mldivide Matrix dimensions must agree.
Error in ==> Untitled4 at 22 r=(a*b)/sqrt((b*cos(O)).^2+(a*sin(O)).^2); % ellipse in polar coordinates

2 件のコメント

Paulo Silva
Paulo Silva 2011 年 5 月 8 日
same thing add a dot before the operation mentioned on the error
./ instead of /
Yoon Hong Ng
Yoon Hong Ng 2011 年 5 月 8 日
Thank you everyone. It is working now.

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

カテゴリ

ヘルプ センター および File ExchangePolar Plots についてさらに検索

製品

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by