# 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?

조회 수: 5(최근 30일)
Chalana Deshan 2021년 7월 25일
댓글: Chalana Deshan 2021년 7월 26일
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 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');
##### 댓글 수: 1표시숨기기 없음
Chalana Deshan 2021년 7월 26일
Thanks <3

댓글을 달려면 로그인하십시오.

R2021a

### Community Treasure Hunt

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

Start Hunting!

Translated by