?? my_qr.m
字號(hào):
function [sys,x0,str,ts] = my_qr(t,x,u,flag)
switch flag,
case 0
[sys,x0,str,ts]=mdlInitializeSizes;
case 3
sys=mdlOutputs(t,x,u);
case { 1, 2, 4, 9 }
sys=[];
otherwise
error(['Unhandled flag = ',num2str(flag)]);
end
function [sys,x0,str,ts] = mdlInitializeSizes()
sizes = simsizes;
sizes.NumContStates = 0;
sizes.NumDiscStates = 0;
sizes.NumOutputs = 64; % dynamically sized
sizes.NumInputs = 32; % dynamically sized
sizes.DirFeedthrough = 1; % has direct feedthrough
sizes.NumSampleTimes = 1;
sys = simsizes(sizes);
str = [];
x0 = [];
ts = [-1 0]; % inherited sample time
% end mdlInitializeSizes
function sys = mdlOutputs(t,x,u)
H_re = reshape(u(1:16),4,4);
H_im = reshape(u(17:32),4,4);
H = H_re + H_im*j;
[Q R] = qr(H);
Q_re = real(Q);
Q_im = imag(Q);
R_re = real(R);
R_im = imag(R);
sys = [reshape(Q_re,16,1);reshape(Q_im,16,1);reshape(R_re,16,1);reshape(R_im,16,1)];
% end mdlOutputs
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -