フィルターのクリア

Why isn't my graph plotting?

1 回表示 (過去 30 日間)
Valeria Chacon
Valeria Chacon 2016 年 11 月 21 日
回答済み: Walter Roberson 2016 年 11 月 21 日
N=4;
R=2;
Phase=pi/4;
theta=zeros(1,N);
x1=R*cos(theta+Phase)/sqrt(2);
y1=R*sin(theta+Phase)/sqrt(2);
plot(x1,y1);
fill(x1,y1,'k');
hold;
x2=R*cos(theta+Phase)/sqrt(2)+R;
y2=R*sin(theta+Phase)/sqrt(2);
plot(x2,y2);
fill(x2,y2,'r');
The graph should show half of the screen black and the other half red but it just gives me a blank graph. What am I doing wrong?

回答 (1 件)

Walter Roberson
Walter Roberson 2016 年 11 月 21 日
All of your x1 are the same; all of your y1 are the same; all of your x2 are the same; all of your y2 are the same.
I would suggest to you that
theta=zeros(1,N);
is not correct, that you should be using a vector of theta values from 0 to something or other. I suspect you want linspace()

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by