MATLAB: Sum of a series finite sumMATLABseriessimulation Hi, Can someone please help me to write the following code using a summation for i = 1:1000v(i) =y(i) - a0- a1*y(i-1)-a2*y(i-2);end Thanks. Best Answer a0=1;a1=2;a2=1;y=rand(1,1000) % your datacoeff=[-a2 -a1 1];for ii = 3:1000 v(ii) =sum(y(ii-2:ii).* coeff)-a0;end Related SolutionsMATLAB: Solving nonlinear equation using newton-raphson method i=0; del = Inf; while del > tol && i<N i=i+1; f(i) = 3*P*V(i).^3 - P*V(i).^2 + 9*V(i) - 8*T*V(i).^2 - 3; df(i) = 9*P*V(i).^2 - 2*P*V(i) - 16*T*V(i) + 9; V(i+1) = V(i) - (f(i)/df(i)); del = abs(V(i+1) - V(i));endlastValue = V(i+1), MATLAB: Is the plot not showing anything for ii=1:n %EDITED if x(ii)<=a v(ii)=((-q*b*x(ii)^2)/(12*E*I))*(3*L+3*a-2*x(ii)); vi(ii)=((-q*b*x)/(2*E*I)).*(L+a-x); else v(ii)=((-q)/(24*E*I))*(x(ii)^4-4*L*x(ii)^3+6*L.^2*x(ii)^2-4*a.^3*x(ii)+a.^4); vi(ii)=((-q)/(6*E*I))*(x(ii)^3-3*L*x(ii)^2+3*L.^2*x(ii)-a.^3); end end plot(x(1:numel(v)),v); hold on plot(x(1:numel(vi)),vi); Related QuestionUnable to perform assignment because the left and right sides have a different number of elements.What is wrong with this code
Best Answer