Plotting the equation and show resolution

3 views (last 30 days)
stefan
stefan on 9 Nov 2014
Answered: Kush on 30 Jun 2023
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

Answers (1)

Kush
Kush on 30 Jun 2023
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');

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!