[Math] Generate samples of sinusoid in matlab

MATLAB

I have to generate 100 samples of sinusoid in matlab with frequency 0.2Hz and sampling rate 2Hz. Until now i have pass into matlab the values:

>> t=[0:99];
>> f=0.2;
>> fs=2;

The sin-wave function is this:

$y(t)=A*sin(2pft+φ)$

Does the Amplitude has some connection with the sampling rate? For example Amplitude values start from 0 and with step of 0.2 did i need to take 100 samples? And how i could find φ in order to plot this signal?

Best Answer

http://en.wikipedia.org/wiki/Sampling_rate Amplitude is generally independent of sampling rate,about phase shift you can omit it now,because actually finding this parameters or method called frequency estimation are many,you can search it on internet

>> f=0.2;
>> fs=2;
>> A=100;%suppose that amplitude is 100
>> q=20;
>> t=0:1/fs:49;
>> x=A*sin(2*pi*f*t+q);
total length is 101,1 more then you want
Related Question