matlab wip

This commit is contained in:
2018-10-11 17:19:48 +02:00
parent f9ddf04fdc
commit cb9310ee5c
8 changed files with 228 additions and 97 deletions

View File

@@ -1,18 +1,54 @@
clear;
clear global;
[mot1,mot2]=identifyFxFyStage();
[Kp,Kvfb,Ki,Kvff,Kaff,MaxInt,mot_num,mot_den,Ts,MaxDac,MaxPosErr,A,B,C,D]=simFxFyStage(mot1,1);
raw=desPos_actPos.Data
raw(:,2)=raw(:,1)*100
ft=fft(raw);
plot(log(abs(ft)));
plot(log(abs(ft(:,1)./ft(:,2))));
[Nbar,A,B,C,Ao,Bo,Co,Do,L,K]=StateSpaceControlDesign(mot1,1);
i=int(minFrq*tSec); j=int(maxFrq*tSec); #print(w[i],w[j])
x=2+3j
rho=abs(x)
theta=angle(x)
%-------------------
x=rho*exp(j*theta)
figure();
h=pzplot(ssc.ss_cl(3),ssc.ss_o(3),ssc.ss_od(3));
setoptions(h,'FreqUnits','Hz','Grid','on');legend('location','sw');
%figure();bode(ssc.ss_o(3));
%figure();tf=tf(ssc.ss_o) pzplot(tf(3));
h=bodeplot(ssc.ss_cl(3),ssc.ss_o(3),ssc.ss_od(3));
setoptions(h,'FreqUnits','Hz','Grid','on');
h=pzplot(ssc.ss_cl(3),ssc.ss_o(3),ssc.ss_od(3));
setoptions(h,'FreqUnits','Hz','Grid','on');
h=bodeplot(ssc.ss_cl(3),ssc.ss_o(3),ssc.ss_od(3));
setoptions(h,'FreqUnits','Hz','Grid','on');
getoptions(h)
continous to discrete
web(fullfile(docroot, 'control/ref/c2d.html'))
h = tf(10,[1 3 10],'IODelay',0.25);
hd = c2d(h,0.1)