Question

In: Advanced Math

Solve the cauchy problem (x^2)*y''-9*x*y'+21*y=0, y'(1)=5 on the interval (1,3). Plot the graphs of y(x) and...

Solve the cauchy problem (x^2)*y''-9*x*y'+21*y=0, y'(1)=5 on the interval (1,3). Plot the graphs of y(x) and y'(x)

Please Provide only MATLAB Code.

Solutions

Expert Solution


%%Matlab code for solving ode
clear all
close all
%Answering question
%Initial conditions for ode
    u0=[0;5];
  
%Solution for equation 1. using ode45
        %minimum and maximum time span
        xspan=[1 3];
        %Solution of ODEs using ode45 matlab function
        [x1,sol1]= ode45(@(x,y) odefcn1(x,y), xspan, u0);

        %Plotting the solution
        figure(1)
        plot(x1,sol1(:,1))
        title('x vs. y(x) plot for ode45')
        xlabel('x')
        ylabel('y(x)')
      
        figure(2)
        plot(x1,sol1(:,2))
        title('x vs. dy(x)/dx plot for ode45')
        xlabel('x')
        ylabel('dy(x)/dx')
     

%Function for evaluating the ODE
function du1dt = odefcn1(x,y)
    eq1=y(2);
    eq2=(9./x).*y(2)-(21./x.^2).*y(1);
  
    %Evaluate the ODE for our present problem
    du1dt = [eq1;eq2];
end

%%%%%%%%%%%%%%%% End of Code %%%%%%%%%%%%%%%%


Related Solutions

Solve the initial value problem. y'=(y^2)+(2xy)+(x^2)-(1), y(0)=1
Solve the initial value problem. y'=(y^2)+(2xy)+(x^2)-(1), y(0)=1
Solve the initial value problem: y''+2y'+y = x^2 , y(0)=0 , y'(0) = 0
Solve the initial value problem: y''+2y'+y = x^2 , y(0)=0 , y'(0) = 0
solve y' +(x+2/x)y =(e^x)/x^2 ; y(1)=0
solve y' +(x+2/x)y =(e^x)/x^2 ; y(1)=0
Solve x′=x−8y, y′=x−3y, x(0)=2, y(0)=1
Solve x′=x−8y, y′=x−3y, x(0)=2, y(0)=1
11. Solve numerically the following Boundary Value Problem. X2Y” – X(X+2)Y’ + (X+2)Y = 0 Y(1)...
11. Solve numerically the following Boundary Value Problem. X2Y” – X(X+2)Y’ + (X+2)Y = 0 Y(1) = e and Y(2) = 2e2 The value of e = 2.71828
Solve the initial value problem: y'' + y = cos(x) y(0) = 2 y'(0) = -3...
Solve the initial value problem: y'' + y = cos(x) y(0) = 2 y'(0) = -3 y' being the first derivative of y(x), y'' being the second derivative, etc.
Plot the function y = 10 *(1 -exp(x/4)) over the interval 0 <x < xmax ,...
Plot the function y = 10 *(1 -exp(x/4)) over the interval 0 <x < xmax , using a for loop to determine the value of xmax such that y(xmax)=9.8. Properly label the plot. variable y is represents force in Newtons , and x represents time in second.
Solve the initial value problem dy/dx = −(2x cos(x^2))y + 6(x^2)e^(− sin(x^2)) , y(0) = −5...
Solve the initial value problem dy/dx = −(2x cos(x^2))y + 6(x^2)e^(− sin(x^2)) , y(0) = −5 Solve the initial value problem dy/dt = (6t^5/(1 + t^6))y + 7(1 + t^6)^2 , y(1) = 8. Find the general solution of dy/dt = (2/t)*y + 3t^2* cos3t
Solve the system by Laplace Transform: x'=x-2y y'=5x-y x(0)=-1, y(0)=2
Solve the system by Laplace Transform: x'=x-2y y'=5x-y x(0)=-1, y(0)=2
solve x^2y^''-4xy^'+6y=lnx^2 y(0)=0, y^'(0)=1
solve x^2y^''-4xy^'+6y=lnx^2 y(0)=0, y^'(0)=1
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT