I need to to solve this coupled ODEs. I have written the code but not really getting any output. Any help would be appreciated!
이전 댓글 표시


function [time, x, xdot, y] = bluff
meff = 0.0114; %Effective mass (kg)
ceff = 0.0212; %Effective damping (N/(m/s))
keff = 8.86; %Effective stiffnes (N/m)
thet = 0.000019758; %Electromechanical coefficient (N/V)
Cp = 0.0000000157; %Capacitance
rho = 1.225; %air density (kg/m3)
u = 10; %wind velocity(m/s)
stip = 0.0118; %exposed area of the bluff body(m2)
L = 0.15 ; %length of the beam
a1 = 2.3; %empirical coefficient for the aerodynamic force calculation
R = 1050000; %load resistance (ohm)
%values
x0 = 1; xdot0 = 0; y0 = 1;
t0 = 0; tf = 60;
%Time span
tspan = [t0, tf];
%initial conditions
IC = [x0, xdot0,y0];
% [sdot] = g(t,s)
sdot = @(t, s) [s(2);
(-ceff*s(2) - keff*s(1) - thet*s(3) + 0.5*rho*stip*(a1*((s(2)/u)+(1.5*s(1)/L))*u^2))/meff;
thet*s(2)/Cp - s(3)/(R*Cp)];
%Call ode45 solver
[time, state_values] = ode45(sdot,tspan,IC);
%Extract individual values
x = state_values(:,1);
xdot = state_values(:,2);
y = state_values(:,3);
%plot x(t) and y(t)
figure(1)
clf
plot(time,x), title('Displacement'), xlabel('time(s)'), ylabel('displacement(m)')
figure(2)
clf
plot(time,y), title ('Voltage generation'), xlabel('time(s)'), ylabel('Output voltage(V)')
end
댓글 수: 9
Walter Roberson
2021년 6월 10일
You need to call your function to get the output.
The output pretty much goes to infinity... but it does show up.
It is confusing that you folded your
into other constants so we cannot be sure it is properly taken into account.
Jayanth Palat
2021년 6월 10일
편집: Jayanth Palat
2021년 6월 10일
Walter Roberson
2021년 6월 11일
Sorry, I did not notice the /meff before. I was expecting an implementation with the same terms in the same order as the equations.
sum(A .* (s(2)/U + 3*s(1)/L).^(1:length(A)))
Jayanth Palat
2021년 6월 11일
편집: Jayanth Palat
2021년 6월 11일
Walter Roberson
2021년 6월 11일
When I test, the values seem to be extracted without difficulty.
If you plot(time) you will see that it rises fairly steadily until roughly the last 30 points, and then it goes through the rest of the time from 22 to 60 within a relatively small number of points.
What is happening there is not it somehow omitting points. What is happening is that ode45() uses adaptive step sizes, and when it reaches that time, the slope of the curve has started to become steep enough that MATLAB feels comfortable taking large time steps.
Jayanth Palat
2021년 6월 11일
편집: Walter Roberson
2021년 6월 11일
Walter Roberson
2021년 6월 11일
As a remote observer: we have no reason to know that the plot that is obtained is not in fact the correct plot for the equations.
Walter Roberson
2021년 6월 11일
You divide by Cp but Cp is about Pi / 2e8 . When you divide by that, values are magnified a lot.
You might have better success if y0 were a lot smaller.
Jayanth Palat
2021년 6월 12일
답변 (1개)
Lewis Fer
2021년 6월 11일
0 개 추천
Hello, I am having troubles solving a system of second order nonlinear equations with boundary conditions using MATALB
Here is the equations:
f''(t)=3*f(t)*g(t) -g(t)+5*t;
g''(t)=-4f(t)*g(t)+f(t)-7*t;
the boundary conditions are: f'(0)=0 et h'(o)=5;
g(0)=3 et h'(2)=h(2)
댓글 수: 3
Walter Roberson
2021년 6월 11일
you should create your own Question for this purpose
Lewis Fer
2021년 6월 11일
I have post my question in this pub, but there is no answer
https://www.mathworks.com/matlabcentral/answers/853120-how-to-solve-a-system-of-second-order-nonlinear-differential-equations-with-boundary-conditions?s_tid=srchtitle#add_answer
카테고리
도움말 센터 및 File Exchange에서 Programming에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!