wip
This commit is contained in:
39
matlab/documentFunctions.m
Normal file
39
matlab/documentFunctions.m
Normal file
@@ -0,0 +1,39 @@
|
||||
|
||||
baseDir='/home/zamofing_t/Documents/prj/SwissFEL/epics_ioc_modules/ESB_MX/python/MXTuningDoc/';
|
||||
%plots bode of desPos_actPos
|
||||
[mot1,mot2]=identifyFxFyStage();
|
||||
close all;
|
||||
[pb]=simFxFyStage(mot2);sim('stage_closed_loop');
|
||||
t=desPos_actPos.Time;
|
||||
u=desPos_actPos.Data(:,1);
|
||||
y=desPos_actPos.Data(:,2);
|
||||
figure(1);
|
||||
clf;
|
||||
plot(t,u,'b');hold on;
|
||||
plot(t,y,'color',[0 .5 0]);
|
||||
grid on;ylim([-4 4]);
|
||||
grid on;ylim([-2 2]);
|
||||
saveas(gca, baseDir+"m2_sim_pb.eps",'epsc');
|
||||
saveas(gca, baseDir+"m1_sim_ss.eps",'epsc');
|
||||
saveas(gca, baseDir+"m2_sim_ss.eps",'epsc');
|
||||
saveas(gca, baseDir+"m1_sim_ss_pref.eps",'epsc');
|
||||
saveas(gca, baseDir+"m2_sim_ss_pref.eps",'epsc');
|
||||
|
||||
|
||||
saveas(gca, baseDir+"m2_mdl_bode.eps",'epsc');
|
||||
|
||||
minFrq=1;maxFrq=1000;
|
||||
tSec=t(length(t));
|
||||
f=(1:length(t))/tSec;
|
||||
fu=fft(u);
|
||||
fy=fft(y);
|
||||
ph=phase(fy./fu)
|
||||
mag=abs(fy)./abs(fu);
|
||||
magDb=20*log10(mag);
|
||||
figure(2);
|
||||
subplot(2,1,1);
|
||||
semilogx(f,magDb);
|
||||
subplot(2,1,2);
|
||||
semilogx(f,ph);
|
||||
grid on;
|
||||
|
||||
Reference in New Issue
Block a user