How to plot coupling functions?

조회 수: 3 (최근 30일)
Toshith Vats
Toshith Vats 2021년 6월 8일
댓글: Toshith Vats 2021년 6월 11일
Want to plot these coupling functions r(t) and p(t) (in image) on a graph. I tried using this code and ended up with a blank graph(without errors) . Kindly help. Please note t varies as 2 to 3 with stepping of 0.01 .
z1 = -1.0629;
z2 = 0.5948;
%Code for r(t)
r_int1 = @(s) (2/3 - s).^(-1/2) .* (6 + abs(r(s))+abs(p(s))) ./ (5.*exp(s+4).*(1+abs(r(s))+abs(p(s))));
r_int2 = @(s) (t-s).^(-1/2) .* (6+abs(r(s))+abs(p(s))) ./ (5*exp(s+4).*(1+abs(r(s))+abs(p(s))));
r = @(t) ( z1.*t.^(-1/3)/gamma(1/2) .* integral(r_int1, 0, 2/3) ) + ( (1/gamma(1/2)) .* integral(r_int2, 0, t) );
%Code for p(t)
p_int1 = @(s) (3/2 - s).^(-4/5) .* (1/exp(2*s)) .* (sin(r(s))+sin(p(s)));
p_int2 = @(s) (t - s).^(-4/5) .* (1/exp(2*s)) .* (sin(r(s))+sin(p(s)));
p = @(t) ( z2.*t.^(-3/2)/gamma(1/5) .* integral(p_int1, 0, 3/2) ) + ( (1/gamma(1/5)) .* integral(p_int2, 0, t) );
fp = fplot(r,p,[2 3]);
fp.Marker = '*';
Funtions to be plotted
  댓글 수: 2
Cris LaPierre
Cris LaPierre 2021년 6월 8일
Without seeing your code, it's hard to say why your plot was empty.
Toshith Vats
Toshith Vats 2021년 6월 8일
Kindly check now I have upated

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

답변 (1개)

Cris LaPierre
Cris LaPierre 2021년 6월 8일
If I don't use fplot, I do get a more descriptive error message. Based on the code you have shared, you are using your function handle r in you computation of r_int1 and r_int2 before it has been defined.
z1 = -1.0629;
z2 = 0.5948;
%Code for r(t)
r_int1 = @(s) (2/3 - s).^(-1/2) .* (6 + abs(r(s))+abs(p(s))) ./ (5.*exp(s+4).*(1+abs(r(s))+abs(p(s))));
r_int2 = @(s) (t-s).^(-1/2) .* (6+abs(r(s))+abs(p(s))) ./ (5*exp(s+4).*(1+abs(r(s))+abs(p(s))));
r = @(t) ( z1.*t.^(-1/3)/gamma(1/2) .* integral(r_int1, 0, 2/3) ) + ( (1/gamma(1/2)) .* integral(r_int2, 0, t) );
%Code for p(t)
p_int1 = @(s) (3/2 - s).^(-4/5) .* (1/exp(2*s)) .* (sin(r(s))+sin(p(s)));
p_int2 = @(s) (t - s).^(-4/5) .* (1/exp(2*s)) .* (sin(r(s))+sin(p(s)));
p = @(t) ( z2.*t.^(-3/2)/gamma(1/5) .* integral(p_int1, 0, 3/2) ) + ( (1/gamma(1/5)) .* integral(p_int2, 0, t) );
% fp = fplot(r,p,[2 3]);
% fp.Marker = '*';
plot(r(2:.01:3),p(2:0.01:3))
Unrecognized function or variable 'r'.

Error in solution (line 5)
r_int1 = @(s) (2/3 - s).^(-1/2) .* (6 + abs(r(s))+abs(p(s))) ./ (5.*exp(s+4).*(1+abs(r(s))+abs(p(s))));

Error in integralCalc/iterateScalarValued (line 314)
fx = FUN(t);

Error in integralCalc/vadapt (line 132)
[q,errbnd] = iterateScalarValued(u,tinterval,pathlen);

Error in integralCalc (line 75)
[q,errbnd] = vadapt(@AtoBInvTransform,interval);

Error in integral (line 87)
Q = integralCalc(fun,a,b,opstruct);

Error in solution (line 7)
r = @(t) ( z1.*t.^(-1/3)/gamma(1/2) .* integral(r_int1, 0, 2/3) ) + ( (1/gamma(1/2)) .* integral(r_int2, 0, t) );
  댓글 수: 6
Cris LaPierre
Cris LaPierre 2021년 6월 9일
I'm not sure I've seen recursive integration before. Perhaps someone else can provide insight on that.
Toshith Vats
Toshith Vats 2021년 6월 11일
Thabnks fot the help

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

카테고리

Help CenterFile Exchange에서 Gamma Functions에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by