Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to write the code for the nonlinear equation using an ode 45 of matlab?

Status
Not open for further replies.

rahul.6sept

Full Member level 5
Joined
Nov 17, 2006
Messages
243
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,298
Location
Guwahati, India
Activity points
2,889
How to write the code for the non linear equation using ode 45 of matlab?

Dear all,

Kindly let me know as how to write the coding using ode45 in Matlab for the following non linear equation:

I'm slightly confused as what are the parameters to be passed in the function that is to be written.

Code:
del Chi/del T = mu(1-BC)(mu[SUP]2[/SUP]/2 -1)*chi*del chi/del x + (mu/AB)del[SUP]3[/SUP]chi/del x[SUP]3[/SUP]


Regards,

Rahul Chakraborty
 

Re: How to write the code for the non linear equation using ode 45 of matlab?

You have Chi as a function of T and x. d/dT(chi) has no T on the right hand side. What is the real problem?
 

Re: How to write the code for the non linear equation using ode 45 of matlab?

I've written the function as

function chi = nonlin (T, chi)

But I'm not sure if the parameters passed are correct or not.
 

Re: How to write the code for the non linear equation using ode 45 of matlab?

You did not read my post; the LHS (d/dT Chi) is a derivative of T but the RHS does not have any T. You need to be explicit with both T and x because these two variables are key ...
 

Re: How to write the code for the non linear equation using ode 45 of matlab?

Yes I missed a sign. This is a kdV nonlinear equation.

del Chi/del T + mu(1-BC)(mu2/2 -1)*chi*del chi/del x + (mu/AB)del3chi/del x3=0
 

Re: How to write the code for the non linear equation using ode 45 of matlab?

I see now; your chi is a function of both T and x and similar problems are seen in heat conduction and diffusion etc. Yes, your function must define the derivatives.
 

Re: How to write the code for the non linear equation using ode 45 of matlab?

Can you guide me as how to find a solution for the same? Any related tutorial if available, will help me immensely.
 

Re: How to write the code for the non linear equation using ode 45 of matlab?

Hi, I,ve written the code, but it is giving a plot not expected.
%the function is for solving of the nonlinear kdv burger equation for the
%ion acoustic waves
% The kdv differential eqn converted to a second order differential eqn is:
% del^2 chi1/del rho^2 = [mu(1-BC)((mu^2/2 -1)chi1 -1)]AB/mu , where A,
% B,C are given by equations as given below in codes
% x denotes rho, y denotes chi1

function dy = kdvnonlin(x,y)

G=6.67*10^-11;
mi=1.67*10^-27;
sigma=0.1;
kappa=100;
gamma=3;
mu=1.0367*10^4;
chi_i=9*10^-1;
lambdaJ=2.1*10^28;
omegaJ=11.83*10^-13;
pi=3.1416;
X=(kappa-0.5)./(kappa-1.5);
A=(4.*pi.*G.*mi.*sigma.*(kappa-0.5))./(kappa-1.5);
B=((1-gamma).*sigma.*X)+(2.*sigma.*X)+1-(sigma.*X.*mu.*(mu+(chi_i./((lambdaJ).^2.*omegaJ)))).^-1;
C=((kappa-1.5)+ sigma.*(kappa-0.5).*(gamma-1))./(kappa-1.5);
y=[0;0];
dy=zeros(2,1);
dy(1)=y(2);
dy(2)= (mu.*(1-B.*C).*((mu.^2)-1).*y(1)-1).*((A.*B)./mu);











%Stability analysis of acoustic waves in nonlinear mode
% this is the main program to call the function

clear all
y0=[1e-2 1e-5];
xspan=0.001:0.1:10;
options=odeset('RelTol',1e-5);
[x,y]=ode45(@(x,y) kdvnonlin(x,y),xspan,y0,options);
%[x,y]=ode45('kdvnonlin',xspan,y0,options);
figure (1)
plot(x:),1),y:),1),'b--');
xlabel('X');
ylabel('Y');
hold on

- - - Updated - - -

Hi, I,ve written the code, but it is giving a plot not expected.
%the function is for solving of the nonlinear kdv burger equation for the
%ion acoustic waves
% The kdv differential eqn converted to a second order differential eqn is:
% del^2 chi1/del rho^2 = [mu(1-BC)((mu^2/2 -1)chi1 -1)]AB/mu , where A,
% B,C are given by equations as given below in codes
% x denotes rho, y denotes chi1

function dy = kdvnonlin(x,y)

G=6.67*10^-11;
mi=1.67*10^-27;
sigma=0.1;
kappa=100;
gamma=3;
mu=1.0367*10^4;
chi_i=9*10^-1;
lambdaJ=2.1*10^28;
omegaJ=11.83*10^-13;
pi=3.1416;
X=(kappa-0.5)./(kappa-1.5);
A=(4.*pi.*G.*mi.*sigma.*(kappa-0.5))./(kappa-1.5);
B=((1-gamma).*sigma.*X)+(2.*sigma.*X)+1-(sigma.*X.*mu.*(mu+(chi_i./((lambdaJ).^2.*omegaJ)))).^-1;
C=((kappa-1.5)+ sigma.*(kappa-0.5).*(gamma-1))./(kappa-1.5);
y=[0;0];
dy=zeros(2,1);
dy(1)=y(2);
dy(2)= (mu.*(1-B.*C).*((mu.^2)-1).*y(1)-1).*((A.*B)./mu);











%Stability analysis of acoustic waves in nonlinear mode
% this is the main program to call the function

clear all
y0=[1e-2 1e-5];
xspan=0.001:0.1:10;
options=odeset('RelTol',1e-5);
[x,y]=ode45(@(x,y) kdvnonlin(x,y),xspan,y0,options);
%[x,y]=ode45('kdvnonlin',xspan,y0,options);
figure (1)
plot(x:),1),y:),1),'b--');
xlabel('X');
ylabel('Y');
hold on
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top