Generate a Sine Wave in which I can change the sampling rate.

2 Ansichten (letzte 30 Tage)
Rory
Rory am 11 Aug. 2014
Kommentiert: Rory am 14 Aug. 2014
i wish to generate a basic sine wave and then plot it.
i then wish to take that basic sine wave and change the sampling rate (say from 1 to 10 to 100 to 1000 sampling points).
i do not have simulink. thanks.

Akzeptierte Antwort

Adriano Bittar
Adriano Bittar am 11 Aug. 2014
Bearbeitet: Adriano Bittar am 11 Aug. 2014
%asks for sample rate
sample_rate = input('Type the sample rate:\n')
%time
t=0:2*pi/sample_rate:2*pi;
%discrete plot
stem(t,sin(t))
  3 Kommentare
Rory
Rory am 14 Aug. 2014
would you know how to make the plot have an x-axis of 0-7 milliseconds and the y axis to have -30 to +50 millivolts?

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Simulink finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by