How to plot coupling functions?
조회 수: 3 (최근 30일)
이전 댓글 표시
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 = '*';
댓글 수: 2
답변 (1개)
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))
댓글 수: 6
Cris LaPierre
2021년 6월 9일
I'm not sure I've seen recursive integration before. Perhaps someone else can provide insight on that.
참고 항목
카테고리
Help Center 및 File Exchange에서 Gamma Functions에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!