📄 ambfn7.m
字号:
T_lbl = uicontrol(inputfig,'style','Text',... 'Pos',[25 y_T 100 20],'String','T');% create K input slidery_K = 300;sli_K = uicontrol(inputfig,'Style','Slider','Position',[125 y_K 300 20],... 'Min',1,'Max',200,'Value',K,'Callback',[... 'set(K_cur,''String'',',... 'num2str(floor(get(sli_K,''Val'')))),',... 'K=floor(get(sli_K,''Val''));',... 'df=F/K/length(u_amp);']);K_cur = uicontrol(inputfig,'style','edit',... 'Pos',[425 y_K 50 20],'String',num2str(floor(get(sli_K,'Value'))),'Callback',[... 'set(sli_K,''Val'',',... 'str2num(get(K_cur,''String''))),',... 'K=floor(get(sli_K,''Val''));',... 'df=F/K/length(u_amp);']);K_lbl = uicontrol(inputfig,'style','Text',... 'Pos',[25 y_K 100 20],'String','K');% create calculate and draw ambiguity function push buttompushtocalculate1=uicontrol(inputfig,'Style','Push','Position',[14 23 112 20 ],... 'String','Ambiguity Fun.','Callback',[... 'if sigflag==0,'... ' calplotsig7;'... 'end;',... 'sigflag=1;',... 'cal_and_plot_amb_fn7;']);% create calculate and draw signal parameters push buttompushtocalculate2=uicontrol(inputfig,'Style','Push','Position',[140 23 112 20 ],... 'String','Cal.&Plot Sig.','Callback',[... 'sigflag=1;'... 'calplotsig7']);% create calculate and draw acfun and spectrum push buttompushtocalculate3=uicontrol(inputfig,'Style','Push','Position',[266 23 112 20 ],... 'String','ACF.&SPEC Plot.','Callback',[... 'if sigflag==0,'... ' calplotsig7;'... 'end;',... 'sigflag=1;',... 'cal_and_plot_acf_and_spec7;']);% create calculate and draw acfun and spectrum push buttompushtocalculate3=uicontrol(inputfig,'Style','Push','Position',[400 23 112 20 ],... 'String','Periodic amb.','Callback',[... 'if sigflag==0,'... ' calplotsig7;'... 'end;',... 'sigflag=1;',... 'cal_and_plot_pamb7;']);% create save signal and grid definition push buttompushtocalculate4=uicontrol(inputfig,'Style','Push','Position',[100 270 112 20 ],... 'String','Save parameters','Callback',[... '[newmatfile,newpath] = uiputfile(''*.mat'', ''Save As'');',... 'if newpath~=0,',... ' wd=cd;',... ' cd(newpath);',... ' eval([''save '' newmatfile '' acode pcode fcode u_amp u_phase f_basic F r N K T'']);',... ' cd(wd);',... 'end']); % create load signal and grid definition push buttompushtocalculate5=uicontrol(inputfig,'Style','Push','Position',[300 270 112 20 ],... 'String','Load parameters','Callback',[... '[newmatfile,newpath] = uigetfile(''*.mat'', ''Load'');',... 'if newpath~=0,',... ' wd=cd;',... ' cd(newpath);',... ' eval([''load '' newmatfile '' acode pcode fcode u_amp u_phase f_basic F r N K T'']);',... ' cd(wd);',... ' set(u_amp_text,''String'',num2str(u_amp));',... ' set(u_amp_on,''Value'',acode);',... ' set(u_phase_text,''String'',num2str(u_phase));',... ' set(u_phase_on,''Value'',pcode);',... ' set(freq_text,''String'',num2str(f_basic));',... ' set(freq_on,''Value'',fcode);',... ' set(sli_F,''Value'',F);',... ' set(F_cur,''String'',num2str(F));',... ' set(sli_r,''Value'',r);',... ' set(r_cur,''String'',num2str(r));',... ' set(sli_N,''Value'',N);',... ' set(N_cur,''String'',num2str(N));',... ' set(sli_K,''Value'',K);',... ' set(K_cur,''String'',num2str(K));',... ' set(sli_T,''Value'',T);',... ' set(T_cur,''String'',num2str(T));',... ' set(preset,''value'',12);',... ' df=F/K/length(u_amp);',... 'end']);% create listbox for selection of preset type of signalspresetnames={'Pulse','LFM ','Weighted LFM','Costas, 7 elements ','Barker, 13 elements','Frank, 16 elements','Complementary pair',... 'Pulse train, 6 pulses','Stepped frequency pulse train, 6 pulses (zoom)',... 'Weighted stepped frequency, 8 pulses (zoom)','P4, 25 elements','User Defined'};z=[0 0 0 0];presetamp={ones(1,13),ones(1,51),ones(1,51).*sqrt(chebwin(51,50))',ones(1,7),... ones(1,13),ones(1,16),[ones(1,3) zeros(1,7) ones(1,3)],[0 0 1 z 1 z 1 z 1 z 1 z 1 0 0],... [0 0 1 z 1 z 1 z 1 z 1 z 1 0 0],[0 0 1 z 1 z 1 z 1 z 1 z 1 z 1 z 1 0 0].*sqrt(chebwin(40,50))',ones(1,25),1};presetphase={zeros(1,13),zeros(1,51),zeros(1,51),zeros(1,7),... [0 0 0 0 0 1 1 0 0 1 0 1 0],[0 0 0 0 0 1/2 1 -1/2 0 1 0 1 0 -1/2 1 1/2],... [0 0 1 zeros(1,7) 0 1/2 0],zeros(1,30),zeros(1,30),zeros(1,40),1/25*(0:24).^2-(0:24),0};presetfreq={zeros(1,13),.0031*[-25:25],.0031*[-25:25],[4 7 1 6 5 2 3]-4,... zeros(1,13),zeros(1,16),zeros(1,13),zeros(1,30),.78*[0 0 -2.5 z -1.5 z -.5 z .5 z 1.5 z 2.5 0 0],.7*[0 0 -3.5 z -2.5 z -1.5 z -.5 z .5 z 1.5 z 2.5 z 3.5 0 0],zeros(1,25),0};presetdf={.007,.0032,.0032,.095,.0308,.0312,.03,.01,.0075,.0075,.0266,.01};presetr={10,1,1,20,10,10,10,10,40,40,5,100};presetN={130,50,50,140,130,160,130,285,45,45,117,100};presetK={50,60,60,60,50,50,60,60,60,60,90,100};presetvalues=struct('Name',presetnames,'amp',presetamp,'phase',presetphase,'freq',presetfreq,... 'df',presetdf,'r',presetr,'N',presetN,'K',presetK);preset = uicontrol(inputfig,'Style','ListBox','position',[20 610 480 50],'String',presetnames,... 'callback',[... ' sigflag=0;'... ' df=presetvalues(get(preset,''value'')).df;',... ' r=presetvalues(get(preset,''value'')).r;',... ' set(r_cur,''String'',num2str(r));',... ' set(sli_r,''val'',r);',... ' N=presetvalues(get(preset,''value'')).N;',... ' set(N_cur,''String'',num2str(N));',... ' set(sli_N,''val'',N);',... ' K=presetvalues(get(preset,''value'')).K;',... ' set(K_cur,''String'',num2str(K));',... ' set(sli_K,''val'',K);',... ' u_amp=presetvalues(get(preset,''value'')).amp;',... ' set(u_amp_text,''String'',num2str(presetvalues(get(preset,''value'')).amp));',... ' set(u_amp_on,''val'',1);',... ' T=N/r/length(u_amp);',... ' set(T_cur,''String'',num2str(T));',... ' set(sli_T,''val'',T);',... ' F=df*K*length(u_amp);',... ' set(F_cur,''String'',num2str(F));',... ' set(sli_F,''val'',F);',... ' u_phase=presetvalues(get(preset,''value'')).phase;',... ' set(u_phase_text,''String'',num2str(presetvalues(get(preset,''value'')).phase));',... ' set(u_phase_on,''val'',1);',... ' set(freq_text,''String'',num2str(presetvalues(get(preset,''value'')).freq));',... ' set(freq_on,''val'',1);',... ' f_basic=presetvalues(get(preset,''value'')).freq;']);% add credits and legend credits=uicontrol(inputfig,'style','text','position',[20 60 480 50],'String',... ['Written by Eli Mozeson and Nadav Levanon' sprintf('\n') ... 'Dept. of EE-Systems, Tel Aviv University']);legend=uicontrol(inputfig,'style','text','position',[20 120 480 140],... 'HorizontalAlignment','left',... 'String',... [ 'Legend:',sprintf('\n') ... 'M - number of bits (length of phase/amplitude/frequency vector)',sprintf('\n') ... 'tb - length of each bit (signal length is M*tb)',sprintf('\n') ... 'r - number of samples per bit',sprintf('\n') ... 'F - maximal Doppler shift for ambiguity and spectrum plot normalized by M*tb',sprintf('\n') ... 'T - maximal delay normalized to M*tb',sprintf('\n') ... 'N - number of delay bins on each side of ambiguity plot',sprintf('\n') ... 'K - number of positive Doppler shifts on ambiguity plot']);legend0=uicontrol(inputfig,'style','text','position',[20 660 480 20],... 'HorizontalAlignment','left',... 'String','Chose a signal from the preset list or define your own using the GUI');legend1=uicontrol(inputfig,'style','text','position',[20 560 480 40],... 'HorizontalAlignment','left',... 'String',... [ 'Edit text to change amplitude, phase or frequency vectors',sprintf('\n') ... 'Use radio bottons on the right to activate or deactivate modulation']);legend2=uicontrol(inputfig,'style','text','position',[20 430 480 40],... 'HorizontalAlignment','left',... 'String',... [ 'Use sliders to continusly increse or decrese values',sprintf('\n') ... 'or use text on the right to enter any value']);figure(inputfig);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -