Problem on printing value of plot
Show older comments
I'm trying to get input for sine wave and then plot it while printing values in command windows. But i'm getting more values than i expected to get.

Is there anything wrong in this code?
clc;
clear;
N = input('Length=') ;
fs = input('Sampling Frequency=') ;
f1 = input('Frequency=') ;
ts = 1/fs ;
t = -(N/(2*fs)):ts:(N/(2*fs)) ;
y = sin(2*pi*f1*t) ;
plot(t,y);
fprintf('Time=%4.1f Amp=%6.1f \n' , t , y) ;
Accepted Answer
More Answers (0)
Categories
Find more on Creating, Deleting, and Querying Graphics Objects in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!