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 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Chalana Deshan
le 25 Juil 2021
Commenté : Chalana Deshan
le 26 Juil 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 commentaires
Réponse acceptée
Image Analyst
le 25 Juil 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');
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Bartlett dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!