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...
Problem 2 (explain each codes please) If more information if needed please let me know 1)...
Problem 2 (explain each codes please) If more information if needed please let me know 1) % time vector t=linspace(0,1,1000); x = zeros(size(t)); y = zeros(size(t)); Meaning: 3)% loop to find the value of x and y for different values of time for i=1:length(t) x(i) = v*cos(angle_theta)*t(i); y(i) = h+v*sin(angle_theta)*t(i)-(0.5*g*(t(i).^2)); end Meaning: 4)% find the first index where y<=0 i.e the ball hits the ground I = find(y<=0,1); fprintf('The ball hits the ground at distance of %f meters\n',x(I)); Meaning: 5)...
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...
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 −...
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...
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...
How to measure the time complexity of an algorithm? Identify an important operation in the algorithm...
How to measure the time complexity of an algorithm? Identify an important operation in the algorithm that is executed most frequently. Express the number of times it is executed as a function of N. Convert this expression into the Big-O notation. A. For each of the three fragments of code, what is its worst-case time complexity, in the form "O(…)". (Use the given solution to the first problem as a model)                 //----------------- This is a sample problem – solved ------...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT