function[r] = do_all_plot(r,x,v) %do_all_plot plots variables contained in r(structure from %do_all_time_lev).Plots error(r.B.y) vs x. x can be %'s'(srate),'N'(order),'t'(time),'p'(impulse response). v can be 's','N','t'. %example: do_all_plot(r,'s','t') makes a plot of error vs srate for %different times. kk=1 err_N_srate=0 err_time=0 err_srate_time=0 err_N_time=0 err_time_srate=0 err_N_srate=0 err_IR_srate=0 if x=='s' err_srate_time=1 end if x=='N' if v=='s' err_N_srate=1 end if v=='t' err_N_time=1 end end if x=='t' if v=='srate' err_time_srate=1 end if v=='t' err_time=1 end end if x=='p' err_IR_srate=1 end %errVSnVARsrate %errVStime %errVSsrateVARtime %errVSnVARtime %errVStimeVARsrate %errVSnVARsrate %errVSirVARsrate %This is to plot in do_all_time.m %Plotting error vs. srate for different times if err_srate_time==1 B=r.B Plot(B(1).s_s,B(1).y_s(:,1),B(1).s_s,B(1).y_s(:,2),B(1).s_s,B(1).y_s(:,3),B(1).s_s,B(1).y_s(:,4),B(1).s_s,B(1).y_s(:,5)) end %plot error vs. N for different times at a given srate if err_N_srate==1 B=r.B Plot(N_vector(1),B(1).y_s(1,:),N_vector(2),B(2).y_s(1,:),N_vector(3),B(3).y_s(1,:)) end %red %magenta %yellow %green %cyan %blue %black %remember gpsclock tconvert %4:30 pm may 19, 1 hour apart %graphing rms of error vs time if err_time==1 plot(x,y); xlabel('time(gps)') ylabel('cts/rHz') title('filter performance over time') legend('rms of cost function') end %Plotting error vs. srate for different times if err_srate_time==1 B=r.B f1=B(3).y_s(:,1) f2=B(3).y_s(:,2) f3=B(3).y_s(:,3) f4=B(3).y_s(:,4) f5=B(3).y_s(:,5) f6=B(3).y_s(:,6) f7=B(3).y_s(:,7) p=B(3).s_s plot(p,f1,'red',p,f2,'magenta',p,f3,'yellow',p,f4,'green',p,f5,'cyan',... p,f6,'blue',p,f7,'black') title('error vs srate for different times N=1024') legend('0hr','1hr','2hr','3hr','4hr','5hr','6hr') ylabel('max rms error(cts/rHz)') xlabel('srate(Hz)') %Plot(B(1).s_s,B(1).y_s(:,1),B(1).s_s,B(1).y_s(:,2),B(1).s_s,B(1).y_s(:,3),B(1).s_s,B(1).y_s(:,4),B(1).s_s,B(1).y_s(:,5)) end %_____________ %plot error vs. srate for different times at given N %plot error vs.N for different times at a given srate (for structure type 3) if err_srate_time==1 B=r.B N_vector=r.B.N u=size(B(kk).y_s)%(number of N's,number of times) leg='' color='bgrcmyk' %looping over N's to make vectors to graph with for ll=1:u(1) q_temp=B(kk).y_s(ll,:) if ll==1 q=q_temp else q=[q;q_temp] end end %looping over times for ll=1:u(2) plot(N_vector,q(:,ll),color(1+mod(ll-1,7))) hold on if ll>9 b='' else b='0' end leg_temp=['time' b num2str(ll)] leg=[leg; leg_temp] end hold off ylabel('max rms error(cts/rHz)') xlabel('srate(Hz)') ti=['error vs srate for different times N=' num2str(r.B(kk).N(kk))] title(ti) legend(leg) end %-------------------------------------------------------------------- %err vs N for diff times at given srate if err_N_time==1 B=r.B N_vector=r.N_vector v=size(B) v=v(2)%number of srate's u=size(B(kk).y_s)%(number of N's,number of times) leg='' color='bgrcmyk' %looping over srate's to make vectors to graph with for ll=1:v q_temp=B(ll).y_s(kk,:) if ll==1 q=q_temp else q=[q;q_temp] end end %looping over times for ll=1:u(2) plot(N_vector,q(:,ll),color(1+mod(ll-1,7))) hold on if ll>9 b='' else b='0' end leg_temp=['time' b num2str(ll)] leg=[leg; leg_temp] end hold off ylabel('max rms error(cts/rHz)') xlabel('srate(Hz)') ti=['error vs srate for different times N=' num2str(r.B(kk).N(kk))] title(ti) legend(leg) end %-------------------------------------------------------------------- %The following doesn't yet work err vs N for diff times if err_time_N==1 B=r256L.B N_vector=r256L.N_vector u=size(B(kk).y_s) leg='' color='bgrcmyk' %looping over N's for ll=1:length(N_vector) q_temp=B(ll).y_s(kk,:) if ll==1 q=q_temp else q=[q;q_temp] end end %looping over times for ll=1:u(2) plot(N_vector,q(:,ll),color(1+mod(ll,8))) leg_temp=['time' num2str(ll)] leg=[leg; leg_temp] hold on end hold off legend([leg]) ylabel('max rms error(cts/rHz)') xlabel('N(order)') title(['error vs N for different times srate=' num2str(r.B(1).s_s(kk))]) end %plot(N_vector,q1,N_vector,q2,N_vector,q3,N_vector,q4,N_vector,q5,N_vector,q6,N_vector,q7)if %err_time_N==1 %err vs N for different srates B=r256L.B N_vector=r256L.N_vector u=size(B(kk).y_s) leg='' color='bgrcmyk' %looping over N's % for ll=1:length(N_vector) for ll=1:5 q_temp=B(ll).y_s(:,kk) if ll==1 q=q_temp' else q=[q;q_temp'] end end %looping over srates for ll=1:u(1) %plot(N_vector,q(:,ll),color(1+mod(ll,8))) temp_srate=B(kk).s_s(ll) plot(N_vector(1:5),q(:,ll),color(1+mod(ll,8))) if ll==1 t='0' else t='' end leg_temp=['srate ' t num2str(B(kk).s_s(ll)) 'Hz'] leg=[leg; leg_temp] hold on end hold off legend([leg]) ylabel('max rms error(cts/rHz)') xlabel('N(order)') title(['error vs N for different srates, time1']) end %plot(N_vector,q1,N_vector,q2,N_vector,q3,N_vector,q4,N_vector,q5,N_vector,q6,N_vector,q7) %plot err vs IR for different srates B=r256L.B N_vector=r256L.N_vector u=size(B(kk).y_s) leg='' color='bgrcmyk' %looping over N's % for ll=1:length(N_vector) for ll=1:5 q_temp=B(ll).y_s(:,kk) if ll==1 q=q_temp' else q=[q;q_temp'] end end %looping over srates for ll=1:u(1) %plot(N_vector,q(:,ll),color(1+mod(ll,8))) temp_srate=B(kk).s_s(ll) plot((N_vector(1:5)*(1/temp_srate)),q(:,ll),color(1+mod(ll,8))) if ll==1 t='0' else t='' end leg_temp=['srate ' t num2str(temp_srate) 'Hz'] leg=[leg; leg_temp] hold on end hold off legend([leg]) ylabel('max rms error(cts/rHz)') xlabel('Impulse Response(seconds)') title(['error vs IR for different srates, time1']) end % plot(N_vector,q1,'red',N_vector,q2,'magenta',N_vector,q3,'yellow',... % N_vector,q4,'green',N_vector,q5,'cyan',N_vector,q6,'blue',... % N_vector,q7,'black') % q1=[B(1).y_s(4,1);B(2).y_s(4,1);B(3).y_s(4,1)] % q2=[B(1).y_s(4,2);B(2).y_s(4,2);B(3).y_s(4,2)] % q3=[B(1).y_s(4,3);B(2).y_s(4,3);B(3).y_s(4,3)] % q4=[B(1).y_s(4,4);B(2).y_s(4,4);B(3).y_s(4,4)] % q5=[B(1).y_s(4,5);B(2).y_s(4,5);B(3).y_s(4,5)] % q6=[B(1).y_s(4,6);B(2).y_s(4,6);B(3).y_s(4,6)] % q7=[B(1).y_s(4,7);B(2).y_s(4,7);B(3).y_s(4,7)] %_____________ %plot error vs. time for different srates at given N if err_time_srate==1 B=r.B w=(B(3).x_s(1,:)-B(3).x_s(1,1))/3600 r1=B(3).y_s(1,:) r2=B(3).y_s(2,:) r3=B(3).y_s(3,:) r4=B(3).y_s(4,:) plot(w,r1,'red',w,r2,'blue',w,r3,'green',w,r4,'black') title('error vs time for different srates N=256') legend('64Hz','128Hz','256Hz','512Hz') ylabel('max rms error(cts/rHz)') xlabel('time(hrs)') end %plot error vs. N for different srate's at given time if err_N_srate==1 for ii=1:4 n=size(r.B) n=n(2) for jj=1:n B_temp=[r.B(jj).y_s(ii,1)] if jj==1 q_s_N_temp=[B_temp] else q_s_N_temp=[q_s_N_temp;B_temp] end end if ii==1 q_s_N=q_s_N_temp else q_s_N=[q_s_N,q_s_N_temp] end end plot(r.N_vector,q_s_N(:,1),'red',r.N_vector,q_s_N(:,2),'yellow',... r.N_vector,q_s_N(:,3),'green',r.N_vector,q_s_N(:,4),'blue') end %,N_vector,q2,'magenta',N_vector,q3,'yellow',N_vector,q4,'green',N_vector,q5,'cyan',N_vector,q6,'blue',N_vector,q7,'black') %Plot error vs. IR for different srates at given time if err_IR_srate==1 for ii=1:4 n=size(r.B) n=n(2) for jj=1:n B_temp=[r.B(jj).y_s(ii,1)] if jj==1 q_s_N_temp=[B_temp] else q_s_N_temp=[q_s_N_temp;B_temp] end end if ii==1 q_s_N=q_s_N_temp else q_s_N=[q_s_N,q_s_N_temp] end end B=r.B q1=[B(1).y_s(1,1);B(2).y_s(1,1);B(3).y_s(1,1)] q2=[B(1).y_s(2,1);B(2).y_s(2,1);B(3).y_s(2,1)] q3=[B(1).y_s(3,1);B(2).y_s(3,1);B(3).y_s(3,1)] q4=[B(1).y_s(4,1);B(2).y_s(4,1);B(3).y_s(4,1)] impulse response IR1=r.N_vector/r.B(1).s_s(1) IR2=r.N_vector/r.B(1).s_s(2) IR3=r.N_vector/r.B(1).s_s(3) IR4=r.N_vector/r.B(1).s_s(4) plot(IR1,q_s_N(:,1),'red',IR2,q_s_N(:,2),'yellow*',... IR3,q_s_N(:,3),'green+',IR4,q_s_N(:,4),'bluex') end