How to plot an Explicit function with inseparable

조회 수: 2 (최근 30일)
Maroua Kebaili
Maroua Kebaili 2020년 10월 11일
답변: Alan Stevens 2020년 10월 11일
I am trying to plot this funtion shown below. I cannot separate the funtion and have P_bar in terms of I_bar to plot the graph. In the equation P is a not a variable and is set at 5000.
I want to rearrange the formulae so that P_bar is in terms of I_bar or vice versa so that I can plot it.
I have tried the below but I am only solving the two equactions at the point where they are equal to each other.
1- syms ibar pbar
2- eqnLeft = 2+(2*ibar/pbar)^2-(4*ibar/1000)*sin(2*ibar/pbar)-2*cos(2*ibar/pbar) - (2*ibar/pbar^2)^2;
3- eqnRight = tan((2*ibar/pbar)*(1-1/2*pbar))- 2*ibar/pbar);
4- fplot([eqnLeft eqnRight])
5- title([texlabel(eqnLeft) ' = ' texlabel(eqnRight)])

답변 (1개)

Alan Stevens
Alan Stevens 2020년 10월 11일
having set values of Ibar you could find Pbar using function fzero. Like so:
Ibar = 1:0.001:2;
pbar = zeros(1,numel(Ibar));
Pbar0 = 1;
for i = 1:numel(Ibar)
pbar(i) = fzero(@Pfn,Pbar0,[],Ibar(i));
end
plot(Ibar,pbar),grid
xlabel('Ibar'),ylabel('Pbar')
function F = Pfn(Pbar,Ibar)
P = 5000;
r = 2*Ibar/Pbar;
if Ibar<=1.166
F = (r/Pbar)^2 - 2 - r^2 + (4*Ibar/P)*sin(r) + 2*cos(r);
else
F = r - tan(r*(1-1/(2*Pbar)));
end
end

카테고리

Help CenterFile Exchange에서 Dimensionality Reduction and Feature Extraction에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by