Bonjour tout le monde. Merci de m'aider à corriger "Unable to convert expression containing symbolic variables into ddouble array"
Code:%Root of linear or nonlinear function % Root-Finding in Matlab of function %defined on interval [a,b] clc %format short %format long % Find all roots of function real. % Solve Eq f(x)=0 on interval [a,b]. L=3; A=1.08; f=@(x) tan(L*x)+2*x; a=-5; b=5; fplot(f,[a,b]),grid on; zero=fzero(@(x)f(x),a); oldzero=zero; zerotot=zero; eps=1e-6; nRoots=100; for i=a:0.01:b zero=fzero(@(x)f(x),i); long=length(zerotot); if abs(zero - zerotot)> eps & (a<= zero) & (zero <= b) zerotot=[zerotot;zero]; long=long+1; end oldzero=zerotot(long); end index=find(zerotot<a); zerotot(index)=[]; index=find(zerotot>b); zerotot(index)=[]; %Check: froots=f(zerotot); % equal to 0? index=find(abs(froots)<=eps); Roots=sort(zerotot(index)) z=0:.1:L;%L;% %dt =.1; for i=1:6 if i==1 T=0; end if i==2 T= .25; end if i==3 T=1;%.2;%*60;% Après 15 min;%1500; end if i==4 T=3;%.2;%*60;% Après 20 min;%0.1; end if i==5 T=7;%.2;%*60;% Après 30 heure;% end if i==6 T=10;%.2;%*60;% Après 40 minutes; end n=length(Roots); syms n %Roots=sort(zerotot(index)); %Roots=subs(sort(zerotot(index))); Roots=sym(sort(zerotot(index))); % symsum(sin(Roots(i )*z).*sin(Roots(i )*L).*exp(-(Roots(i ).^2).*t )./(1+... % L /2+2*L*Roots(i ).^2),1,length(Roots)); symsum(sin(Roots.*sym(z)).*sin(Roots*L).*exp(-(Roots.^2).*sym(T) )./(1+... L /2+2*L*Roots.^2),1,n); fsum=symsum(sin(Roots.*sym(z)).*sin(Roots*L).*exp(-(Roots.^2).*sym(T) )./(1+... L /2+2*L*Roots.^2),1,n); f=log(A -(A-1)*exp(-sym(z))-4*(A)*exp(L-... sym(z)).*exp(-sym(T) ).*fsum); %subs % fplot(double(f),z) end F=subs(f) % plot(double(f),z) plot(double(F),z) %end
-----