Please design a GUI that plots a sinusoidal we for the given
Please design a GUI that plots a sinusoidal we for the given input frequency when a push button is clicked. You can choose a sin wave or a cosine wave using a radio button. The sin graph should be plotted in red and the cosine graph should be in blue. Time axis is from 0 sec to 0.5 sec and the time step is 1msec. In the plot, x and v labels should be presented. An example GUI is given below.
Solution
function pushbutton1_Callback(hObject, eventdata, handles) % when the button plot is pushed f = str2num(get(handles.edit1,\'String\')); %geting f A = str2num(get(handles.edit2,\'String\')); % geting A t = 1:100 sine = A* sin(0.02*pi*f*t); cosine = A * cos(0.02*pi*f*t); val =double(get(handles.popupmenu1,\'Value\')); %geting popupmenu value(1 or 2) if val==1 plot(sine); else plot(cosine) end