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

1 view (last 30 days)

Show older comments

germanbrain common
on 25 Aug 2019

Commented: Image Analyst
on 27 Aug 2019

clc;clear all; close all;

A=1;

x=0:0.1:1;

sample=16;

y=A*sin((2*pi./sample)*x)

figure

plot(x,y)

##### 4 Comments

### Accepted Answer

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);

##### 3 Comments

Image Analyst
on 27 Aug 2019

### More Answers (0)

### See Also

### Categories

### Community Treasure Hunt

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

Start Hunting!