sinusoidal signal with an amplitude of 3V and a 50 Hz frequency. time from 0 to 0.05 s along the time axis.. can someone help me to do this?
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Chalana Deshan
am 25 Jul. 2021
Kommentiert: Chalana Deshan
am 26 Jul. 2021
How to draw sinusoidal signal with an amplitude of 3V and a 50 Hz frequency. time from 0 to 0.05 s along the time axis
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 25 Jul. 2021
Try this (assuming it's not your homework):
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
clear; % Erase all existing variables. Or clearvars if you want.
workspace; % Make sure the workspace panel is showing.
format short g;
format compact;
fontSize = 15;
fprintf('Beginning to run %s.m ...\n', mfilename);
% sinusoidal signal with an amplitude of 3V and a 50 Hz frequency.
% time from 0 to 0.05 s along the time axis
amplitude = 3;
omega = 50; % Hertz, cycles per second.
period = 1 / omega;
fprintf('For a frequency of %.1d Hz, the period is %.4f.\n', omega, period);
% Make the x axis.
numPoints = 1920; % HDTV resolution so it will stretch across your screen at one data point per pixel.
t = linspace(0, 0.05, numPoints);
% Create the signal
y = amplitude * sin(2 * pi * omega * t);
% Plot the signal
plot(t, y, 'b-', 'LineWidth', 2);
title('y vs. t. 50 Hz signal', 'FontSize', fontSize);
xlabel('t', 'FontSize', fontSize);
ylabel('y', 'FontSize', fontSize);
grid on;
% Put a black line along the x axis
yline(0, 'LineWidth', 3);
% Put a red line at the period and twice the period.
xline(period, 'LineWidth', 3, 'Color', 'r');
xline(2 * period, 'LineWidth', 3, 'Color', 'r');
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Bartlett 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!