GUI vectors dimensions problem

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 个评论

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)

回答(0 个)

此问题已关闭。

标签

提问:

2014-12-2

关闭:

2021-8-20

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by