Problem with the plot of function besselj.
Show older comments
I have this code:
nu=1;
whitebg('k')
x=0:1e-3:9;
for n=1:4
paso=1/2^(n-1);
y1=besselj(nu,x);
figure(n),close(n),figure(n)
hold on
plot(x,y1,'b')
h=1e-5;
yder1=(besselj(nu,2+h)-besselj(nu,2))/h;
yder2=(besselj(nu,8+h)-besselj(nu,8))/h;
nodos=2:paso:8;
yvalues=besselj(nu,nodos);
y2=spline(nodos,[0.009,yvalues,0.5588],x);
plot(x,y2,'r')
y3=spline(nodos,[yder1,yvalues,yder2],x);
plot(x,y3,'w')
y4=spline(nodos,yvalues,x);
plot(x,y4,'g')
y5=interp1(nodos,yvalues,x);
plot(x,y5,'c')
grid
title('Bessel function for nu=1')
xlabel('Eje x')
ylabel('Eje y')
legend('Besselj','Spline sujeto mal','Spline sujeto bien',...
'Spline not-a-knot','Interp1','location','best')
end
But I don't know why the graphs of the function 'besselj' seem to decrease with every iteration. I would like the function 'besselj' to always display the same plot, that's why the variable 'nu' is constant in my script.




Here's the link to function 'besselj':
Accepted Answer
More Answers (1)
Ricardo Boza Villar
on 19 May 2016
0 votes
Categories
Find more on Spline Postprocessing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!