How to plot an Explicit function with inseparable

16 次查看(过去 30 天)
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