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 (최근 30일)
% 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)

채택된 답변

KSSV
KSSV 2022년 6월 22일
Use:
fplot(W(r))
  댓글 수: 3
AVINASH SAHU
AVINASH SAHU 2022년 6월 22일
Thank you. And how to plot multiple graphs for different values of psi on the same figure?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by