Polarplot for loop with subplots
21 次查看(过去 30 天)
显示 更早的评论
t =(2*pi)/(1*10^100):(2*pi)/1000:2*pi; %theta
k = 1/2;
L = k*lambda; %Length
B = 2*pi/lambda; %Beta
E = (cos((B*L/2)*cos(t)) - cos(B*L/2))./(sin(t));
P = E.^2;
polarplot(t,P, 'Linewidth', 1.5) % to plot the P vs theta curve
title('Dipole Radiation Power (L = \lambda/2)', 'Fontsize', 10)
set(gca, 'Fontsize', 15)
I need to change the code so that k = [0.25, 0.5, 1, 1.4, 2, 2.5]
i then need to use a for loop to plot 6 different plots using subplot so that i can view and compare all 6 plots at once
I have tried so many different options, im not the best with matlab so any help would be great.
thank you
0 个评论
采纳的回答
VBBV
2021-5-17
%if true
lambda = 1; t =(2*pi)/(1*10^100):(2*pi)/1000:2*pi; %theta; lambda = 1;
k = [0.25 0.5 1 1.4 2 2.5];
for i = 1:length(k)
L = k(i)*lambda; %Length
B = 2*pi/lambda; %Beta
E = (cos((B*L/2).*cos(t)) - cos(B*L/2))./(sin(t));
P = E.^2;
subplot(6,1,i)
polarplot(t,P, 'Linewidth', 1.5) % to plot the P vs theta curve
title('Dipole Radiation Power (L = \lambda/2)', 'Fontsize', 4)
set(gca, 'Fontsize', 4);hold on;
end
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Polar Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!