Plotting the equation and show resolution

1 回表示 (過去 30 日間)
stefan
stefan 2014 年 11 月 9 日
回答済み: Kush 2023 年 6 月 30 日
Plot the magnitude (absolute value) and phase (angle) of the following function
i=sqrt(-1);
G(i*omega)= (-0.72*exp(-i*30*omega))/1+(i*50*omega);
from omega=0.001 to 1000 rad/sec.
Take sufficient points; say 1000, within the range 0.001 ≤ omega ≤ 1000 rad/sec to increase the resolution of your plots

回答 (1 件)

Kush
Kush 2023 年 6 月 30 日
You can use anonymous function to implement the above like this:
% Define the frequency range
omega = logspace(-3, 3, 1000);
% Define the function
G = @(omega) (-0.72*exp(-1*30*omega))./(1+(50*omega));
% Calculate the magnitude and phase
magnitude = abs(G(1i*omega));
phase = angle(G(1i*omega));
% Plot the magnitude figure;
semilogx(omega, magnitude);
xlabel('Frequency (rad/sec)');
ylabel('Magnitude');
title('Magnitude Plot');
% Plot the phase figure;
semilogx(omega, phase);
xlabel('Frequency (rad/sec)');
ylabel('Phase (rad)');
title('Phase Plot');

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by