Ode45 and diff function problem
Show older comments
Hello.
I made the fallowing program for project.It's supposed to show the sigma graphic with the help of ode45 function.The problem is i have a bit of a complex system whitch i need to solve.Something like:
p2*d^2sigma/dt^2+p1*dsigma/dt +p0sigma=q2*d^2epsilon/dt^2+q1*depsilon/dt+q0*epsilon (differential reprezentation of series pairing of Maxwell and Kelvin reologic models)
I wanted to make it simple at first and took the epsilon function as a single constant variable but i have some errors in useing the diff function in the "sistem_cu_ec_de_gradul_1"function.
This is the fallowing program:
function serie_maxwell_kelvin
E1=input('E1=');
niu1=input('niu1=');
E2=input('E2=');
niu2=input('niu2=');
p2=niu2/E1;
p1=1+E2/E1+niu2/niu1;
p0=E2/niu1;
q2=niu2;
q1=E2;
q0=0;
t=linspace(0,10,100);
sigma_initial=0;
dsigmadt_initial=0;
[t,x]=ode45(@sistemul_cu_ec_de_gradul_1,t,[sigma_initial dsigmadt_initial]);
plot(t,x(:,1));
xlabel('t');
ylabel('sigma');
function[dxdt]=sistemul_cu_ec_de_gradul_1(t,x)
dxdt_2=x(1);
dxdt_1=-(p1/p2)*x(1)-(p0/p2)*x(2)+(q2/p2)*diff(epsilon,t,2)+(q1/p2)*diff(epsilon,t)+(q0/p2)*epsilon(t);
%dxdt_1=-(p1/p2)*x(1)-(p0/p2)*x(2)+(q2/p2)*0+(q1/p2)*0+(q0/p2)*epsilon(t);
dxdt=[dxdt_2; dxdt_1];
end
function [z] = epsilon(t)
z=6;
end
end
As start i took the E1=10,niu1=5,E2=10,niu2=5.
Accepted Answer
More Answers (0)
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!