How to plot an Explicit function with inseparable

7 visualizaciones (últimos 30 días)
Maroua Kebaili
Maroua Kebaili el 11 de Oct. de 2020
Respondida: Alan Stevens el 11 de Oct. de 2020
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)])

Respuestas (1)

Alan Stevens
Alan Stevens el 11 de Oct. de 2020
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

Categorías

Más información sobre Dimensionality Reduction and Feature Extraction en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by