CS计算机代考程序代写 matlab clear all;
clear all; close all; Delta_t=0.1; t=0:Delta_t:50; % %Preallocating Memory % x=zeros(length(t),3); x(1,1)=0.0;x(1,2)=1.0;x(1,3)=1.0; for n=1:length(t)-1 x(n+1,:)=Findxnplus1(Delta_t,x(n,:)); end %Check with Matlab solution [tmat,xmat] = ode23(@Example22p2,[0 50],[0 1 1]); hold off plot(t,x(:,1),’k-.’,tmat,xmat(:,1),’k-‘); hold on plot(t,x(:,2),’b-.’,tmat,xmat(:,2),’b-‘); legend(‘x_0(t) Implicit Euler’,’x_0(t) MATLAB ode23()’,’x_1(t) Implicit Euler’,’x_1(t) MATLAB ode23()’); xlabel(‘t’,’Fontsize’,18);ylabel(‘x_i(t)’,’Fontsize’,18); function p=Findxnplus1(Delta_t,xn) eps=1.0; %Just making sure you go through the loop at least […]
CS计算机代考程序代写 matlab clear all; Read More »