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 Center および File ExchangeDimensionality 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