Salut,
y a t il une erreur dans mon code matlab ? car ce dernier ne trace que la derniere iteration du boucle for malgré la préallocation des matrices !
Merci par avance de m 'aider.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14 function plot_cubic_spline(x,a,b,c,d) yy=zeros(n,nint); xx=zeros(n,nint); xi=zeros(n,nint); n = length(x); nint = 10; for i=1:n-1 xx = linspace(x(i),x(i+1),nint); %Divide each data interval into nint points xi = repmat(x(i),1,nint); yy = a(i) + b(i)*(xx-xi) + ... b(i)*(xx-xi).^2 + d(i)*(xx - xi).^3; plot(x,y,'*',xx,yy) end
Partager