second order differential systems of a non linear ODE

Considering theth differential system equations to be solved are:
f''(t) = 3*f(t)*g(t) + 5 g''(t) = 4*g(t)*f(t) + 7 with initial conditions: f(0) = 1.5, g'(0) = 0 and boundary constraints tf = 1: g(1) = 3, f'(1) =q* f(1)
With q is natural number
how we can plot the solution satysfying the boundary conditions

8 Comments

This sound like a job fpr bvp4c .
how we can do it Mr Jan?
Start with reading the corresponding documentation:
doc bvp4c
Then modify the exmples given there to your problem. If you have a specific problem with this, post the details here.
The information, that q is a natural number does not allow to implement this. The readers of your question cannot guess, if you want to run the code for a certain number of inputs, if you should find a specific value of q.
The problem is : The differential system equations to be solved are: f''(t) = 3*f(t)*g(t) + 5 g''(t) = 4*g(t)*f(t) + 7 with initial conditions: f(0) = 1.5, g'(0) = 0 and boundary constraints tf = 1: g(1) = 3, f'(1) =2* f(1) ( for example q=2 )
I have already solve the problem with q=1 but for q different to 1 I have not, I used the following code in
:
%%%%%%%%%%
main function
xmesh = linspace(0,1,10);
sol = bvpinit(xmesh, @iguess);
sol = bvp5c(@odefcn,@bcfcn,sol,bvpset('RelTol ' ,1e-13 ,'AbsTol ',1e-13,'Nmax ',6000))
Y0 = sol.y(:,1)
solde45 = ode45(@odefcn,[0,1],Y0,odeset('RelTol',1e-13,'AbsTol',1e-13))
close all;
figure;
ylblstr = ['f','g', 'h=fp ','j = gp '];
for i = 1:4
subplot(4,1,i); hold on
plot(sol.x,sol.y(i,:))
plot(solde45.x,solde45.y(i,:),'--')
ylabel(ylblstr(i))
end
xlabel('t')
function res = bcfcn(ya,yb)
%
% f(0) = 1.5
% g'(0) = 0 -> j(0) = 0
% g(2) = 3
% f'(2) = f(2) -> h(2) = f(2)
res = [
ya(1) - 1.5;
ya(4) - 0;
yb(2) - 3;
yb(1) - yb(3);
];
end
function Y = iguess(x)
f = sin(x);
g = cos(x);
h = cos(x);
j = -sin(x);
Y = [f;g;h;j];
end
function dY = odefcn(t,Y)
% f'' = 3 f g + 5
% g'' = 4 f g + 7
% let h = f'
% let j = g'
% Y = [f;g;h;j]
f = Y(1,:);
g = Y(2,:);
h = Y(3,:);
j = Y(4,:);
dY = [
h;
j;
3*f*g + 5;
4*f*g + 7;
];
end
What is your problem with solving the problem for different q? There is a huge number of different natural number, so what is the actual problem you want to solve?
I want solve this problem for each natural number that we want to test some results about the Effect when we have q <10 and q>10 fo rexample ?
Can you show me how to do it for a general case of a given natural number?
in mathematic can we replace : f'(1) =2* f(1) by f'(1)=2*exp(2) ?
in mathematic can we replace : f'(1) =q* f(1) by f'(1)=q*exp(q) ? because the solution of the differential equation
f'(x) =q* f(x) has the forme f(x)=C*exp(qx) and I know tha C in our case equal=1

Sign in to comment.

Answers (1)

Small typo err in your code:
xmesh = linspace(0,1,10);
sol = bvpinit(xmesh, @iguess);
sol = bvp5c(@odefcn,@bcfcn,sol,bvpset('RelTol ' ,1e-13 ,'AbsTol ',1e-13,'Nmax ',6000)); % ERR: No space after: 'RelTol', 'AbsTol', 'Nmax'

1 Comment

I fix it this err thank you Sulaymon Eshkabilov , and the main question how to do it if q=2 or 3 for example ?

Sign in to comment.

Products

Release

R2015b

Asked:

on 17 Jun 2021

Commented:

on 19 Jun 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!