I want to plot between "W" on y axis and "r" on x axis, with "W" ranging from 0 to 0.2 in the interval of 0.05 and "r" ranging from 1 to 6 in the interval of 1. How to do it?

2 Ansichten (letzte 30 Tage)
% plotting graph
syms r
psi = 1;
alpha = (12*psi)^(1/3);
l1 = @(r) (r + alpha)*(r + alpha);
l1a = @(r) r*r - r*alpha + alpha*alpha;
L1 = @(r) log(l1(r)/l1a(r));
t1 =@(r) (2*r - alpha) / (alpha*sqrt(3));
T1 =@(r) atan(t1(r));
l2 =@(r) (1 + alpha)*(1 + alpha);
l2a =@(r) (1*1) - (1*alpha) + (alpha*alpha);
L2 =@(r) log(l2(r)/l2a(r));
t2 =@(r) (2*1 - alpha) / (alpha*sqrt(3));
T2 =@(r) atan(t2(r));
W1 =@(r) 4 * sqrt(3) * (T1(r) - T2(r)) * log((r+alpha)/(1+alpha));
W2 =@(r) (L1(r) - L2(r))*log((r*r - r*alpha + alpha*alpha)/(1 - alpha + alpha*alpha));
W3 =@(r) 4*(T1(r) -T2(r))*(T1(r) -T2(r));
W4 =@(r) (L1(r) - L2(r)) + 2 * sqrt(3) * (T1(r) - T2(r));
W5 =@(r) 3 ./ ((r - 1) * (r - 1));
W =@(r) ((W1(r) + W2(r) -W3(r)) * W5(r))/W4(r);
fplot(@(r) W(r))
I am getting the following warning
Warning: Function behaves unexpectedly on array inputs. To improve performance, properly vectorize your function to return an output with the
same size and shape as the input arguments.
> In matlab.graphics.function.FunctionLine>getFunction
In matlab.graphics.function/FunctionLine/updateFunction
In matlab.graphics.function/FunctionLine/set.Function_I
In matlab.graphics.function/FunctionLine/set.Function
In matlab.graphics.function.FunctionLine
In fplot>singleFplot (line 245)
In fplot>@(f)singleFplot(cax,{f},limits,extraOpts,args) (line 200)
In fplot>vectorizeFplot (line 200)
In fplot (line 166)
In plots (line 28)

Akzeptierte Antwort

KSSV
KSSV am 22 Jun. 2022
Use:
fplot(W(r))
  3 Kommentare
AVINASH SAHU
AVINASH SAHU am 22 Jun. 2022
Thank you. And how to plot multiple graphs for different values of psi on the same figure?

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by