How can i plot the magnitude and phase response for given output?

4 Ansichten (letzte 30 Tage)

Akzeptierte Antwort

Star Strider
Star Strider am 4 Mär. 2018
First, code the function you posted an image of. It would be best to create it as a transfer function object, using the tf function. See the relevant documentation for details.
Then, use the bode (link) or lsim (link) functions, depending on what you want to do.
Note that for a SISO system, you will have to use squeeze to plot the result, if you want to plot the outputs of bode and the others.
Example
[mag,phase,wout] = bode(tfobj);
figure(3)
subplot(2,1,1)
semilogx(wout, 20*log10(squeeze(mag)), '-b', 'LineWidth',1) % Bode Plot: Magnitude
ylabel('H(f) (dB)')
grid
subplot(2,1,2)
semilogx(wout, squeeze(phase), '-b', 'LineWidth',1) % Bode Plot: Phase
xlabel('Frequency (rad/sec)')
ylabel('Phase (°)')
grid

Weitere Antworten (0)

Kategorien

Mehr zu Plot Customization finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by