how do i plot the output vo against frequency ? i tried out however my graph seems weird thank you in advance

2 views (last 30 days)
Av=1+(Rf/Ri_minus);
Vo= (1+(Rf/Ri_minus))*Vin;
Vonew=subs(Vo,{Rf,Ri_minus,Vin},{10,20,30})
f = 50 %Hz
% x = linspace(0, 2*pi, 1000);
y = Vonew* sin((2 * pi * f/1000*(0:19))); %sample time sie of 1000,20x [0:19] 1 time period
plot( y, 'b-', 'LineWidth', 2);
xlabel('time', 'FontSize', 20);
ylabel('vo', 'FontSize', 20);
title('vo vs time', 'FontSize', 20);
this is my codes however the graph seems a little weird
thank you inadvance

Answers (1)

VBBV
VBBV on 14 Feb 2022
Edited: VBBV on 14 Feb 2022
% Rf = 1.1;
% Ri_minus = 0.2;
% Vin = 10;
syms Rf Ri_minus Vin
Av=1+(Rf/Ri_minus);
Vo= (1+(Rf/Ri_minus))*Vin;
Vonew=subs(Vo,[Rf,Ri_minus,Vin],[10,20,30])
Vonew = 
45
f = 50; %Hz
% x = linspace(0, 2*pi, 1000);
y = Vonew* sin((2 * pi * f/1000*(0:19))); %sample time sie of 1000,20x [0:19] 1 time period
plot(y, 'b-', 'LineWidth', 2);
xlabel('time', 'FontSize', 20);
ylabel('vo', 'FontSize', 20);
title('vo vs time', 'FontSize', 20);
f = linspace(20,100,length(0:19)); %Hz
% x = linspace(0, 2*pi, 1000);
y = Vonew* sin((2 * pi * f./1000.*(0:19))); %sample time sie of 1000,20x [0:19] 1 time period
figure(2)
plot(f,y, 'b-', 'LineWidth', 2);
xlabel('frequency', 'FontSize', 20);
ylabel('vo', 'FontSize', 20);
title('vo vs frequency ', 'FontSize', 20);

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!