MATLAB Answers

why im not able plot graph in 1 sec window of 16 sample

2 views (last 30 days)
clc;clear all; close all;


Show 1 older comment
germanbrain common
germanbrain common on 25 Aug 2019
In one sec window i have to plot sine wave with 16 points.
dpb on 25 Aug 2019

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 25 Aug 2019
You didn't have anough points to see the sine wave so all you see is a traingle wave. Increase the number of points and use linspace():
numPoints = 50; % Whatever
Amplitude = 1;
t = linspace(0, 1, numPoints);
period = 0.4; % Seconds -- whatever you want;
y = Amplitude * sin((2*pi./period) * t)
plot(t, y, 'bo-', 'LineWidth', 2, 'MarkerSize', 9)
grid on;
xlabel('Time', 'FontSize', 13);
ylabel('Y', 'FontSize', 13);
title('Sine Wave', 'FontSize', 13);
0000 Screenshot.png


germanbrain common
germanbrain common on 27 Aug 2019
thank you, but one question i am having here here my input signal is 1 sec or 1hz fre and what about sampling frequnecy here??
Fs is how much?
PS: I need one full cycle in 1 second,in your plot i can se 2.5 cycle.
Image Analyst
Image Analyst on 27 Aug 2019
fs (omega) is (2*pi/period). For a 1 second, 1Hz chunk of signal, you'll have one wave of the sine wave. You can pick whatever sampling rate you want. Of course the higher it is, the more accurately you'll draw the signal.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by