Help needed for ODE - coupled equations. piezoelectric wind energy harvester

2 ビュー (過去 30 日間)
Jayanth Palat
Jayanth Palat 2021 年 6 月 10 日
Im new to MATLAB. I have been trying to solve this for the past 7 hours. I dont know whats wrong with the code. Any help would be appreciated! Thank you
The x value when plotted with time should give a oscillating wave but all im getting is zero for both this and y and then it goes to infinity.
This is the equation
This is the code that I wrote
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)
q = R*Cp ;
%values
x0 = 0; xdot0 = 0; y0 = 0;
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)/meff - keff*s(1)/meff - thet*s(3)/meff + 0.5*rho*stip*u*u*(a1*((s(2)/u)+(1.5*s(1)/L)))/meff ;
thet*s(2)/Cp - s(3)/q];
%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

回答 (0 件)

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by