why am I getting matrix dimension error..?

1 回表示 (過去 30 日間)
Sai Monika Ananthoju
Sai Monika Ananthoju 2021 年 7 月 29 日
編集済み: Sai Monika Ananthoju 2021 年 7 月 30 日
when i tried to run this code , its displaying the "matrix dimension must agree". I want the plot for phase angle at various frequencies. and when i used for loop i got the result only for last iteration and plot shows only last iterated point. can i get a help on this.
clc;
clear;
close all;
d=0.23;
theta=40;
f=1:18;
lamda(f)=3*0.1/f;
phaseangle(lamda)=(2*pi/(lambda))*d*sin(theta);
plot(f,phaseangle,'-o')
xlabel('frequency(Ghz)')
ylabel('phase angle')
%%%%%
clc;
clear;
close all;
d=0.23;
theta=40;
for f=1:1:18;
lamda=3*0.1/f;
phaseangle=(2*pi/(lambda))*d*sin(theta);
plot(f,phaseangle,'-o')
xlabel('frequency(Ghz)')
ylabel('phase angle')
end

採用された回答

Yongjian Feng
Yongjian Feng 2021 年 7 月 29 日
There are several errors typos.
clc;
clear;
close all;
d=0.23;
theta=40;
f=1:18;
lambda =3*0.1./f;
phaseangle=(2*pi./(lambda))*d*sin(theta);
plot(f,phaseangle,'-o')
xlabel('frequency(Ghz)')
ylabel('phase angle')
%%%%%
clc;
clear;
close all;
d=0.23;
theta=40;
for f=1:1:18
lambda=3*0.1/f;
phaseangle=(2*pi./(lambda))*d*sin(theta);
plot(f,phaseangle,'-o')
xlabel('frequency(Ghz)')
ylabel('phase angle')
end
  3 件のコメント
Yongjian Feng
Yongjian Feng 2021 年 7 月 29 日
You actually want this, right?
clc;
clear;
close all;
d=0.23;
theta=40;
f=1:18;
lambda=3*0.1./f;
phaseangle=(2*pi./(lambda))*d*sin(theta);
plot(f,phaseangle,'-o')
xlabel('frequency(Ghz)')
ylabel('phase angle')
Sai Monika Ananthoju
Sai Monika Ananthoju 2021 年 7 月 29 日
編集済み: Sai Monika Ananthoju 2021 年 7 月 30 日
Yes sir. Thank you.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatched Filter and Ambiguity Function についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by