Categories: Excelling Homework

MATH 2860 University of Toronto Editing Code for Eulers Method IVP Matlab Assignment I’ll post the code given below, if you can edit it and paste the solut

MATH 2860 University of Toronto Editing Code for Eulers Method IVP Matlab Assignment I’ll post the code given below, if you can edit it and paste the solution back to me I would greatly appreciate it, let me know if you need more info:

>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Don't use plagiarized sources. Get Your Custom Essay on
MATH 2860 University of Toronto Editing Code for Eulers Method IVP Matlab Assignment I’ll post the code given below, if you can edit it and paste the solut
For $10/Page 0nly
Order Essay

% adjust the following (READ THROUGH GREEN LINE COMMENTS TO FIND THEM):

% IVP: x0,y0,dy/dx=F(x,y);

% step size h (this is set up as a row matrix with one entry for each h value in the question);

% xlast the x value of the desired approximation

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

x0=1;

y0=1;

h=[0.5 0.1 0.05];

xlast=4;

% then next few lines you need not touch; they refer to the plot options

fig=figure(‘Visible’,’off’); % this will hold off on giving you a figure and instead produce a printable pdf in your current folder

symbls={‘.’,’+’,’o’,’+’,’o’,’.’};

colrs={‘r’,’b’,’g’,’g’,’b’,’r’};

markersizes=[ 15 5 5 5 5 15];

ys=[];

b=y0;

f=y0;

% the following nested for loops perform the euler method iterations for

% each specified h

for j=1:length(h);

x=x0;

y=y0;

xx=[x0];

yy=[y0];

hh=h(j);

nsteps=(xlast-x0)/hh; % this calculates the number of iterations needed to complete the procedure

for i=1:1:nsteps;

F=0.2*x*y; % CHANGE NEEDED: THIS IS SOMETHING YOU WILL NEED TO ADJUST AS YOUR dy/dx=F IS DIFFERENT

y=y+hh*F;

x=x+hh;

xx=[xx x];

yy=[yy y];

end

bb=min(yy);

b=min(b,bb);

ff=max(yy);

f=max(ff,f);

ys=[ys y];

plot(xx,yy,symbls{j},’MarkerSize’,markersizes(j),’color’,colrs{j});

hold on % this allows you to overlay one plot over another

end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% you will need to solve the separable differential equation by hand and

% input here your solution as a formula on x: y=…

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

x=x0:0.01:xlast;

y=exp(0.1*(x.^2-1)); % CHANGE NEEDED: your EXACT solution SHOULD BE SUBBED IN HERE

actual=y(length(y)) % shows off only in your command window

approx=[h; ys] % shows off only in command window; first row is h value, underneath is corresponding ylast approximation

plot(x,y,’LineWidth’,2,’color’,’k’);

hold off

% the following lines will just adjust plot options — viewing box, labels

axis tight;

xlabel ‘x’, ylabel ‘y’;

a=min(y);

c=min(a,b);

e=max(y);

d=max(e,f);

xlim([x0 xlast]);

ylim([c-.5 d+.5]);

legend(‘Euler with h=0.5′,’Euler with h=0.1′,’Euler with h=0.05′,’Exact Solution’); % CHANGE NEEDED if your step sizes are different

title ‘MATH2860Assignment 1, Fall2017, your TA name, your name’; % CHANGE NEEDED: this title needs to be changed

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% the following 4 lines creat a pdf (in your current folder) with the name

% MATH2860Assignment1 you can print and submit as part of your assignment

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

set(fig,’PaperOrientation’,’landscape’);

set(fig,’PaperUnits’,’normalized’);

set(fig,’PaperPosition’, [0 0 1 1]);

print(fig,’-dpdf’,’MATH2860Fall2013Assignment1′);

clear(‘F’,’a’,’b’,’e’,’f’,’c’,’d’,’h’,’hh’,’i’,’j’,’colrs’,’markersizes’,’symbls’,’nsteps’,’x’,’x0′,’y’,’y0′,’xx’,’yy’,’xlast’,’fig’,’bb’,’ff’); Consider the following Initial Value Problem (IVP):
dy
– y cos x sin x = 0, y(T/2) = 1
dr
Use Euler’s method to approximate the solution for r values between
0 and 3 using the matlab file provided (make the appropriate changes
in that file) with step sizes h = 0.1, h = 0.05, h = 0.01.

Purchase answer to see full
attachment

admin

Recent Posts

Economic Debate #3- Progressive Income Tax – The Homework Helper

Economic Debate- Progressive Income Tax For this Economic Debate, we are going to discuss the…

2 years ago

MKT 6120 – Marketing Management – Davis Learning Engagement #7

TOPIC: Going Global Discussion Thread 1 (initial post due Wednesday for full credit) Please note:…

4 years ago

jvjvjhvjhvhjvj

Assignment Topic This week will culminate in the creation of a narrated PowerPoint to create…

4 years ago

Students are supposed to select a technological organization of their choice.

The Assignment must be submitted on Blackboard (WORD format only) via allocated folder. Assignments submitted…

4 years ago

Increases the risk of wildfires

you need to post your 2-page information flier to share with your Final Project Group.…

4 years ago

Statistics for Technology management

discussion: Discuss the methods used at your company to measure and ensure quality products and…

4 years ago