How do I use ode45 for solving this problem and using the solutions as parameters for solving the next system?

조회 수: 1 (최근 30일)
Dear Matlab-community, I got a problem solving some differential-equations-systems.
First I have to say, that I am a beginner in Matlab. I got a system consisting of 6 first order differential equations as a boundary value problem, but I can split them into 3 systems with initial conditions, so I should be able to solve it using ode45. I have to solve the first system and then for solving the second system I need one of the solutions from the first system as a parameter for each x to go on. First I have to solve this system:
(I): Q1’=kappa*Q2 (II): Q2’=-kappa*Q1 (III): -(Q2+dI*kappa)/(E*I)
The (initial)-conditions are: Q1(l)=F1; Q2(l)=F2; Kappa(l)= Ml3/(E*Il), using Il = (B*H^3)/12;
My Matlab code for the function is:
function dy = rigid(x,y)
E = 210000;
I = 3*x; %Funktion für I
dI = 3; %Ableitung dI von I nach dem Weg
dy = zeros(3,1); % a column vector
dy(1) = y(3)*y(2);
dy(2) = -y(3)*y(1);
dy(3) = (-y(2)+dI*y(3))/(E*I);
and my main program:
clc
clear all
%Eingangsparameter:
E = 210000; %N/mm²
Ml3 = 264; %Nmm
F1 = 10; %N
F2 = -15; %N
l = 25; %mm // Länge der Kontur
B = 5; %mm
H = 10; %mm
Il = (B*H^3)/12;
Randbedingung3 = Ml3/(E*Il);
options = odeset('RelTol',1e-4,'AbsTol',[1e-4 1e-4 1e-5]);
[X,Y] = ode45(@rigid,[0 l],[F1 F2 Randbedingung3],options);
plot(X,Y(:,1),'-',X,Y(:,2),'-.',X,Y(:,3),'.')
I do not get any values for the solution. I think the problem is that my conditions are not like Q1(0)=…, Q2(0)=…, but at the end of the interval l. I have no idea how to solve this. It would be awesome if someone could pleas help me with this problem and with the following problem:
I need to get the values for y(1), y(2) and y(3) for each x between [0:l]. Then I need to use y(3)(x) which is kappa(x) for solving the next equation:
(i): theta’=kappa with the initial condition theta(x=0)=0 which is easy to solve by getting theta=kappa*x. But therefore I do not know how to get the values for kappa from the solution of the first system for each x.
It would be awesome if someone could please help me out here :-)
  댓글 수: 17
Torsten
Torsten 2015년 1월 22일
Does it not work when you set
y=deval(sol,sol.x);
plot(sol.x,y(1,:),sol.x,y(2,:),sol.x,y(3,:),sol.x,y(4,:),sol.x,y(5,:),sol.x,y(6,:));
?
Best wishes
Torsten.
Stefan Henning
Stefan Henning 2015년 1월 22일
Thank you! I did not understand the deval function, or how to use it. Now it works with your code and it gives the exact same results like the plot(sol.x,sol.y(1,:),...) So I guess it does not matter to define yb=L
Thanks a lot
Stefan.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Smoothing and Denoising에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by