How to plot coupling functions?

3 vues (au cours des 30 derniers jours)
Toshith Vats
Toshith Vats le 8 Juin 2021
Commenté : Toshith Vats le 11 Juin 2021
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 commentaires
Cris LaPierre
Cris LaPierre le 8 Juin 2021
Without seeing your code, it's hard to say why your plot was empty.
Toshith Vats
Toshith Vats le 8 Juin 2021
Kindly check now I have upated

Connectez-vous pour commenter.

Réponses (1)

Cris LaPierre
Cris LaPierre le 8 Juin 2021
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 commentaires
Cris LaPierre
Cris LaPierre le 9 Juin 2021
I'm not sure I've seen recursive integration before. Perhaps someone else can provide insight on that.
Toshith Vats
Toshith Vats le 11 Juin 2021
Thabnks fot the help

Connectez-vous pour commenter.

Catégories

En savoir plus sur Gamma Functions dans Help Center et File Exchange

Produits


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by