Last active
March 25, 2020 09:05
-
-
Save sbasami/2b4bae759765fd02f3ffb08463b8bc83 to your computer and use it in GitHub Desktop.
MATLABでDCモータのモデル同定を行うプログラム
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clear all; | |
clc; | |
%エクセルファイルから入出力データの取り込み | |
FR.u = xlsread('DCmotor_FR_500Hz.xlsx',1,'B1:B15714'); | |
FR.y = xlsread('DCmotor_FR_500Hz.xlsx',1,'D1:D15714'); | |
FRdata = iddata(FR.y,FR.u,0.002); %IDDATA オブジェクトの作成 | |
FRdata.InputName = '電圧 [V]'; %入力データの名前 | |
FRdata.OutputName = '角速度 [rad/s]';%出力データの名前 | |
figure(1), plot(FRdata);%入出力データの表示 | |
FRdata_det = detrend(FRdata);%データの平均値を0にする | |
G1 = tfest(FRdata_det, 1, 0)%極が1、零が0のモデルを同定 | |
G2 = tfest(FRdata_det, 2, 0)%極が2、零が0のモデルを同定 | |
figure(2), compare(FRdata,G1, G2);%モデルの応答比較の表示 | |
save('model_500Hz.mat','G1','G2')%変数の保存 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment