How can I generate a sine signal where I can manipulate the input parameters such as its amplitude, frequency, start time and phase?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
This is my layout. I used edit text to enter the value. In plot callback I used the following coding to get the input and generate the signal when the plot push button is clicked.
a1 = str2num(get(handles.edit_amplitude,'String')); % get input for Textbox1
a2 = str2num(get(handles.edit_frequency,'String')); % get input for Textbox2
a3 = str2num(get(handles.edit_phase,'String')); % get input for Textbox3
a4 = str2num(get(handles.edit_time1,'String')); % get input for Textbox4
a5 = str2num(get(handles.edit_time2,'String')); % get input for Textbox5
From here what coding should I do to generate the sine signal?
3 comentarios
dpb
el 11 de Mzo. de 2015
OK, looks like you did pick up on the omega=2pi*f portion; that looks ok. Now for the time vector, have you heard about the Nyquist sampling frequency?
Try just at the command line a short series; you'll see that to generate a representative sine you have to sample at more than just the frequency of the fundamental frequency or you only get a hit-n-miss representation; in fact if the sample frequency is at the same frequency as the sine then you only get a single value--one at each period but the same location in relative phase so you get what?--a straight line on a plot.
Respuestas (0)
Ver también
Categorías
Más información sobre Waveform Generation en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!