How can I generate a sine signal where I can manipulate the input parameters such as its amplitude, frequency, start time and phase?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
dpb
am 11 Mär. 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.
Antworten (0)
Siehe auch
Kategorien
Mehr zu Waveform Generation 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!