ODE for frequency response

I would like to model above ODE and see the frequency response for w being frequency.
Can anyone please give me an advice? I am not sure this is even possible to solve..

 采纳的回答

This takes a while to run, so I used relatively coarse mesh intervals (for ‘tspan’ and ‘omega’) to run it here.
Experiment with it —
syms x(t) omega t x0 Y
sympref('AbbreviateOutput',false);
Dx = diff(x);
Eqn = 2*Dx*exp(1i*omega*t) + x*(1i*omega)^2 + 1000*x*exp(1i*omega*t) == exp(1i*10*t)
Eqn(t) = 
X = dsolve(Eqn, x(0)==x0)
X = 
X = subs(X,{x0},{0})
X = 
X(omega,t) = simplify(X,500)
X(omega, t) = 
[VF,Subs] = odeToVectorField(Eqn)
VF = 
Subs = 
Xfcn = matlabFunction(VF, 'Vars',{t,Y,omega})
Xfcn = function_handle with value:
@(t,Y,omega)[(exp(omega.*t.*-1i).*(exp(t.*1.0e+1i)-exp(omega.*t.*1i).*Y(1).*1.0e+3+omega.^2.*Y(1)))./2.0]
tspan = linspace(0, 15, 11);
omegav = linspace(0, 600, 7);
for k = 1:numel(omegav)
[t,x] = ode45(@(t,x)Xfcn(t,x,omegav(k)), tspan, 0);
tv{k} = t;
xv{k} = x;
end
tvm = cell2mat(tv);
xvm = cell2mat(xv);
omegavm = repmat(omegav,11,1);
figure
surf(tvm, omegavm, abs(xvm), 'FaceAlpha',0.5)
xlabel('Time')
ylabel('Frequency')
zlabel('|X(\omega,t)|')
colormap(turbo)
set(gca,'ZScale','log')
.

更多回答(0 个)

类别

标签

Community Treasure Hunt

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

Start Hunting!

Translated by