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 (최근 30일)
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

채택된 답변

Image Analyst
Image Analyst 2021년 7월 25일
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');

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Bartlett에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by