Practical MATLAB Modeling with Simulink by Sulaymon L. Eshkabilov

Practical MATLAB Modeling with Simulink by Sulaymon L. Eshkabilov

Author:Sulaymon L. Eshkabilov
Language: eng
Format: epub
ISBN: 9781484257999
Publisher: Apress


Example 1

Here is the example problem: .

with the initial condition . The given ODE can be rewritten in the form of an implicit differential equation expressed in Equation (8.44), as shown here:

Subsequently, this can also be expressed as follows:

and as follows:

Note that the expression of F(t, y, dy) = 0 is the main difference in defining F in implicit ODEs from explicit ones. In this example, the F function, containing three arguments (which are ), can be expressed via an anonymous function (@) directly. Here is the complete solution, called IMPLICIT_1ODE_EX1.m:% IMPLICIT_1ODE_EX1.m

%{

EXAMPLE 1. Problem: t^2*y'+t*(y')^2+2*cos(t)=1/y with ICs: y(0)=1/2;

Part 1.

The problem function is defined via function handle under name of Yin.

A new variable is introduced: dy=yp.

%}

clearvars; close all

Yin=@(t,y, yp)(t^2*yp+t*yp^2+2*cos(t)-1/y);

y0=1/2; yp0=0; % Initial conditions

[t, yt]=ode15i(Yin, [0, 6*pi], y0, yp0);

plot(t, yt, 'bo-')

title('\it Simulation of: $$ t^2*\frac{dy}{dt}+t*(\frac{dy}{dt})^2+2*cos(t)=y^{-1}, y_0=\frac{1}{2} $$', 'interpreter', 'latex')

grid on;

xlabel('\it t'),

ylabel( '\it Solution, y(t)'),

hold on



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.