How to plot bode plot in 3D?

8 visualizaciones (últimos 30 días)
SimTec
SimTec el 10 de Nov. de 2022
Respondida: Star Strider el 10 de Nov. de 2022
Hi guys,
I have a transfer function that has two variables f(frequency) and C(capacity).
if I take the C as constant I can plot the frequency response for a C that is constant. Mag_db vs f_Hz
However, as I have 10 different C capacitor and I would like to add another axial that shows the bode plot for each C in 3D.

Respuestas (1)

Star Strider
Star Strider el 10 de Nov. de 2022
Try something like this —
Fs = 44100;
Ts = 1/Fs;
f = logspace(-3, +5, fix(Fs/10));
w = 2*pi*f(:);
R = 1e3; % resistor value [Ohms]
C = 2*171.368563054e-9; % Capacitor value [Farads]
Cv = C + (-4:5)*5E-8;
for k = 1:numel(Cv)
C = Cv(k);
numerator = [(R*C)^2 0 1];
denominator = [(R*C)^2,4*R*C,1];
H = tf(numerator,denominator);
[mag,phase] = bode(H,w);
magm(:,k) = squeeze(mag);
phsm(:,k) = squeeze(phase);
end
lgdc = compose('C = %10.2E',Cv);
figure
subplot(2,1,1)
semilogx(w, mag2db(magm))
grid
legend(lgdc, 'Location','best')
subplot(2,1,2)
semilogx(w, rad2deg(phsm))
grid
M1 = ((0:9).' + ones(numel(Cv), numel(w))).';
figure
subplot(2,1,1)
plot3(M1+w, M1, mag2db(magm))
grid on
Ax = gca;
Ax.YTick = 1:10;
Ax.YTickLabel = Cv;
xlabel('\omega')
ylabel('C')
zlabel('|H(\omega)| (dB)')
subplot(2,1,2)
plot3(M1+w, M1, rad2deg(phsm))
grid on
Ax = gca;
Ax.YTick = 1:10;
Ax.YTickLabel = Cv;
xlabel('\omega')
ylabel('C')
zlabel('Phase (°)')
MATLAB Answers was down for several hours earlier today. Posting this now.
.

Categorías

Más información sobre Plot Customization en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by