matlab indexing issue with range -pi:pi
2 次查看(过去 30 天)
显示 更早的评论
I have following code, which i need to plot for alpha versus theta.
But i am unable to index it properly.
Kindly help. Thanks in anticipation. Regards
amin=0.2;
for theta=-3.1416:1.5708:3.1416 (-pi:pi/2:pi)
for gamma=0:0.5:3
phi=amin-(-pi/2);
alpha((?),(gamma*2)+1)=(1-amin)*(((sin(theta-phi)+1)/2).^gamma)+amin;
end
end
0 个评论
采纳的回答
VBBV
2022-5-20
编辑:VBBV
2022-5-20
amin=0.2;
theta = -pi:pi/2:pi;
gamma=0:0.5:3;
for T=1:length(theta)
for G = 1:length(gamma)
phi=amin-(-pi/2);
alpha(T,G)=((1-amin)*(((sin(theta(T)-phi)+1)/2).^gamma(G))+amin)/((gamma(G)*2)+1);
end
end
plot(theta,alpha)
xlabel('theta');ylabel('alpha')
2 个评论
Walter Roberson
2022-5-26
The maximum value is 1 exactly and it is being plotted. You need to ylim([0 1.1])
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Gamma Functions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!