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