How to plot two equation consequetively

조회 수: 13 (최근 30일)
safi58
safi58 2016년 12월 7일
댓글: safi58 2016년 12월 7일
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

채택된 답변

Walter Roberson
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 CenterFile Exchange에서 Mathematics에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by