GUI vectors dimensions problem
Info
This question is closed. Reopen it to edit or answer.
Show older comments
I have created a gui file. That will take the signal's length,frequency,magnitude and phase and evaluate a sine signal according to this info and plot it. Everything works perfectly except phase term. When i try to consider phase shift in my calculation, i got "vector dimensions must agree" error. I am not able to add shift on my signal. The code i used fot this is below. What am i doing wrong ? Please help me it's urgent. Thank you.
%Get inputs from GUI
fs=str2double(get(handles.Fs,'String'));
a=str2double(get(handles.A,'String'));
p=str2double(get(handles.phase,'String'));
t = eval(get(handles.time,'String'));
phi=degtorad(p);
%Calculation
y=a*sin(2*pi*t+phi); <---- Problem is here.
% Create time plot in proper axes
plot(handles.time_waveform,t,y);
1 Comment
Geoff Hayes
on 2 Dec 2014
Mustafa - please past the complete error message. Also, put a breakpoint in the code at the line
y=a*sin(2*pi*t+phi);
and run your GUI. When the debugger pauses at this line, type the following lines in the Command Window, and record the results
size(a)
size(t)
size(phi)
Answers (0)
This question is closed.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!