Question

Your objective in Problem 2 is to employ Euler's Method to determine what goes wrong when...

Your objective in Problem 2 is to employ Euler's Method to determine what goes wrong when the interval is [ 0, 1 ]. To this end, I want you to create another new
script, EulerMethod3, which is intended to approximate the "solution" to the IVP given below.
         dy/dx = (1/9)*(y^10)        where.          y(0) = 1.            over the interval. [ 0, 1 ]

I was given the code below for a different question, but I don't know how to modify it to solve this problem. Can someone help me modify this code to solve this problem and also state why this IVP has no solution on the interval [0,1].

function EulerMethod2 (n)
X=0:1/n:.5;
Y=zeros(1, n+1);
Y(1)=1;
for k=1:n
m=y(k);
Y(k+1)=Y(k)+m*(X(k+1)-X(k));
end
clf
plot(X,Y)

Homework Answers

Answer #1

#include<stdio.h>
#include<math.h>
float fun(float x,float y)
{
float f;
f=pow(y,10)/9.0;
return f;
}
main()
{
float a,b,x,y,h,t,k;
printf("\nEnter x0,y0,h,xn: ");
scanf("%f%f%f%f",&a,&b,&h,&t);
x=a;
y=b;
printf("\n x\t y\n");
while(x<t)
{
k=h*fun(x,y);
y=y+k;
x=x+h;
printf("%0.3f\t%0.3f\n",x,y);
}
}

//result :

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Using the Script: function EulerMethod1(n) X = 0 : 1/n : 1 ; Y = zeros(...
Using the Script: function EulerMethod1(n) X = 0 : 1/n : 1 ; Y = zeros( 1, n + 1 ) ; Y(1) = 1 ; for k = 1 : n m = Y(k) ; Y(k + 1) = Y(k) + m*( X(k + 1) - X(k) ) ; end clf plot( X, Y ) Create a new script, which defines the function EulerMethod2. The purpose of EulerMethod2 is to use Euler's Method to approximate the solution to the...
Solve the given initial-value problem. (x + 2) dy dx + y = ln(x), y(1) =...
Solve the given initial-value problem. (x + 2) dy dx + y = ln(x), y(1) = 10 y(x) = Give the largest interval I over which the solution is defined. (Enter your answer using interval notation.) I =
Consider the initial value problem given below. y' = (x+y+1)2 , y(0)= -1 The solution to...
Consider the initial value problem given below. y' = (x+y+1)2 , y(0)= -1 The solution to this initial value problem crosses the x-axis at a point in the interval [0, 1.4]. By experimenting with the improved Euler's method subroutine, determine this point to two decimal points.
Problem 3 you can use Matlab and also i give u the Problem 1 code its...
Problem 3 you can use Matlab and also i give u the Problem 1 code its on Matlab Using the same initial code fragment as in Problem 1, add code that calculates and plays y (n)=h(n)?x (n) where h(n) is the impulse response of an IIR bandpass filter with band edge frequencies 750 Hz and 850 Hz and based on a 4th order Butterworth prototype. Name your program p3.sce this is the Problem 1 code and the solutin clear; clc;...
1) State the main difference between an ODE and a PDE? 2) Name two of the...
1) State the main difference between an ODE and a PDE? 2) Name two of the three archetypal PDEs? 3) Write the equation used to compute the Wronskian for two differentiable functions, y1 and y2. 4) What can you conclude about two differentiable functions, y1 and y2, if their Wronskian is nonzero? 5) (2 pts) If two functions, y1 and y2, solve a 2nd order DE, what does the Principle of Superposition guarantee? 6) (8 pts, 4 pts each) State...
Problem 1 ...... you can use Matlan i got one so all what i need is...
Problem 1 ...... you can use Matlan i got one so all what i need is 2, 3 and 4 one of them or all of them .. thanks The following Scilab code generates a 10-second “chirp” with discrete frequencies ranging from 0 to 0.2 with a sampling frequency of 8 kHz. clear; Fs = 8000; Nbits = 16; tMax = 10; N = Fs*tMax+1; f = linspace(0.0,0.2,N); x = zeros(f); phi = 0; for n=0:N-1 x(n+1) = 0.8*sin(phi); phi...
6) (8 pts, 4 pts each) State the order of each ODE, then classify each of...
6) (8 pts, 4 pts each) State the order of each ODE, then classify each of them as linear/nonlinear, homogeneous/inhomogeneous, and autonomous/nonautonomous. A) Unforced Pendulum: θ′′ + γ θ′ + ω^2sin θ = 0 B) Simple RLC Circuit with a 9V Battery: Lq′′ + Rq′ +(1/c)q = 9 7) (8 pts) Find all critical points for the given DE, draw a phase line for the system, then state the stability of each critical point. Logistic Equation: y′ = ry(1 −...
1. Solve the given initial value problem. dy/dt = (t^3 + t)/(y^2); y(0) = 2 ....
1. Solve the given initial value problem. dy/dt = (t^3 + t)/(y^2); y(0) = 2 . 2. We know from Newton’s Law of Cooling that the rate at which a cold soda warms up is proportional to the difference between the ambient temperature of the room and the temperature of the drink. The differential equation corresponding to this situation is given by y' = k(M − y) where k is a positive constant. The solution to this equation is given...
Modify your Free Fall program below to plot the energy vs. time for a baseball dropped...
Modify your Free Fall program below to plot the energy vs. time for a baseball dropped from a height of 1000 feet until it hits the ground. Now add in the effects of air resistance into your program. This time, on the energy plot, you will plot four quantities: KE (Red line), PE (Green line), Energy lost due to air resistance (purple line), and total Energy (blue circles). Note, you must calculate the energy lost by using the definition of...
R Code Directions: All work has to be your own, you may not work in groups....
R Code Directions: All work has to be your own, you may not work in groups. Show all work. Submit your solutions in a pdf document on Moodle. Include your R code (which must be commented and properly indented) in the pdf file. Name this pdf file ‘your last name’-HW5.pdf. Also submit one text file with your R code, which must be commented and properly indented. You may only use ‘runif’ to generate random numbers; other random number generating functions...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT