How to plot two equation consequetively
1 次查看(过去 30 天)
显示 更早的评论
Hi, I have written this code and need to plot jlralph and jlrgamma in a continuous way from 0 to alpharange and alpharange to alpharange2 respectively.
mc0 = -0.5;
jlr0 = -0.8;
M = 0.99;
alpharange = 6.5; %// degrees
alpharange2 = 180; %// degrees
mcalpha = (mc0 - (1 / M) - 1) * cos(alpharange) + jlr0 * sin(alpharange) + (1/M) + 1
jlralpha = ((-mc0) + (1 / M) + 1) * sin(alpharange) + jlr0 * cos(alpharange)
for i=0:1:alpharange
jlralph = ((-mc0) + (1 / M) + 1) * sin(i) + jlr0 * cos(i)
for x=alpharange:1:alpharange2
jlrgamma = ((-mcalpha) + (1 / M) - 1) * sin(x- alpharange) + jlralpha * cos(x- alpharange);
end
end
How do I do that
0 个评论
采纳的回答
Walter Roberson
2016-12-7
mc0 = -0.5;
jlr0 = -0.8;
M = 0.99;
alpharange = 6.5; %// degrees
alpharange2 = 180; %// degrees
mcalpha = (mc0 - (1 / M) - 1) * cosd(alpharange) + jlr0 * sind(alpharange) + (1/M) + 1;
jlralpha = ((-mc0) + (1 / M) + 1) * sind(alpharange) + jlr0 * cosd(alpharange);
%above here I only changed sin to sind and cos to cosd
%below here is vectorized computations. Note sin and cos changed to sind and cosd
alpha1 = linspace(0, alpharange);
jlralph = ((-mc0) + (1 / M) + 1) * sind(alpha1) + jlr0 * cosd(alpha1);
alpha2 = linspace(alpharange, alpharange2);
jlrgamma = ((-mcalpha) + (1 / M) - 1) * sind(alpha2 - alpharange) + jlralpha * cosd( alpha2 - alpharange);
plot([alpha1, alpha2], [jlralph, jlrgamma])
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Decomposition 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!