140 Trang 7 5 nh, phù h Trang 8 VI ADS-B - Automatic Dependent Surveillance-Broadcast AM Amplitude Modulation: AWGN Additive BER Bit error rateBPSK Binary Phase Shift KeyingCPFSK Conti
Các file và hàm
Script là m file f = [1 1]; i = 1; while(f(i)+f(i+1)) M-file Editor
Callback c function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to radiobutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of radiobutton1
% - function mnuTool_Callback(hObject, eventdata, handles)
% hObject handle to mnuTool (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
New Menu Item: hành pushbutton1, mnuTool
3 Radio Button String: Celcius, Rankine, Kelvin
Value: 1.0, 0.0, 0.0 Tag: radiobuttonC, radiobuttonR, radiobuttonK Static text String: Fahrenheit degree
Static text String: Celcius degree
46 BÀI 2: -GUI (GRAPHIC USER INTERFACE)
% - Executes on button press in pushbuttonConvert function pushbuttonConvert_Callback(hObject, eventdata, handles)
% hObject handle to pushbuttonConvert (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA) doF = str2num(get(handles.editDoF,'String')); if get(handles.radiobuttonC,'Value') == 1
% Chuyen oC set(handles.editKQ,'String',num2str((doF-32)*5/9)); elseif get(handles.radiobuttonR,'Value') == 1
%Chuyen oR set(handles.editKQ,'String',doF+459.7); else
%Chuyen oK set(handles.editKQ,'String',(doF-32)*5/9+273.15); end
% - Executes on button press in radiobuttonC function radiobuttonC_Callback(hObject, eventdata, handles)
% hObject handle to radiobuttonC (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of radiobuttonC set(handles.radiobuttonK,'Value',0); set(handles.radiobuttonR,'Value',0); set(handles.text2,'String','Celcius degree');
% - Executes on button press in radiobuttonR function radiobuttonR_Callback(hObject, eventdata, handles)
% hObject handle to radiobuttonR (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of radiobuttonR set(handles.radiobuttonC,'Value',0); set(handles.radiobuttonK,'Value',0); set(handles.text2,'String','Rankine degree');
% - Executes on button press in radiobuttonK function radiobuttonK_Callback(hObject, eventdata, handles)
% hObject handle to radiobuttonK (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of radiobuttonK set(handles.radiobuttonR,'Value',0); set(handles.radiobuttonC,'Value',0);
48 BÀI 2: -GUI (GRAPHIC USER INTERFACE) set(handles.text2,'String','Kelvin degree');
% - Executes on slider movement function sliderDoF_Callback(hObject, eventdata, handles)
% hObject handle to sliderDoF (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider set(handles.editDoF,'String',get(handles.sliderDoF,'Value'));
Sin Sinc Cos Exit View
50 BÀI 2: -GUI (GRAPHIC USER INTERFACE)
String: 5 Tag: editAmp Static Text:
String: 10 Tag: editFreq Static Text:
String: Function Pop-up Menu:
String: cos sin sinc Tag: popupmenuFunc Button:
String: Draw Tag: pushbuttonDraw Axes:
SYMBOLIC
TÍCH PHÂN
y atan(x) do hà y int(log(x)/exp(x^2), x) y ẳ y=int(x^3*atan(x),0,pi/4) y pi/16 - atan(pi/4)/4 + (pi^4*atan(pi/4))/1024 - pi^3/768
eval(y) ans = 0.0529 dùng hàm quad tính tích y = inline('log(x)./exp(x.^2)'); quad(y,0,1) ans -0.9059
Warning: finverse(x^2) is not unique ans x^(1/2)
3.4 V TH syms x subplot(211);ezplot(sin(x)/x) subplot(212);ezplot(sin(x)/x,0,4*pi)
3.5 NH D NG BI U TH C syms s y=int('sin(s+2*x)','s',pi/2,pi) y cos(2*x) - sin(2*x) pretty(y) cos(2 x) - sin(2 x) f = sym('x^2-1'); factor(f) ans (x - 1)*(x + 1) y=expand((x+1)^3-2*(x-1)^2) y x^3 + x^2 + 7*x - 1 y=simplify(sin(x)^2+cos(x)^2) y 1 y=simplify((1-x^2)/(1-x)) y x + 1 simplify((1/x^3+6/x^2+12/x+8)^(1/3)) ans ((2*x + 1)^3/x^3)^(1/3)
Dùn vi phân y=solve(x^3+2*x^2+1==0) y root(z^3 + 2*z^2 + 1, z, 1) root(z^3 + 2*z^2 + 1, z, 2) root(z^3 + 2*z^2 + 1, z, 3) i y=vpa(y) y -2.2055694304005903117020286177838
-0.3166 giác: solve(2*cos(x)+2) ans pi solve(2*cos(x)) ans pi/2 solve(cos(x)=sin(x)) ans pi/4 y=solve(exp(x)==tan(x)) y -226.19467105846511316931032359612
60 BÀI 3: SYMBOLIC y=dsolve('Dy=y*tan(x)+cos(x)',x) y (x/2 + sin(2*x)/4)/cos(x) + C4/cos(x) y = simplify(y) y (4*C4 + 2*x + sin(2*x))/(4*cos(x)) pretty(y)
4 cos(x) y=dsolve('Dy=1+y^2','y(0)=1','x') y tan(pi/4 + x) y=dsolve('D2y=cos(2*x)- y (5*cos(x))/3 + sin(x) + sin(x)*(sin(x) - (8*tan(x/2)^2*sin(x))/(3*(tan(x/2)^2 + 1)^2)) - (2*cos(x)*(- 3*tan(x/2)^4 + 6*tan(x/2)^2 + 1))/(3*(tan(x/2)^2 + 1)^3) y= simplify(y) y (2*tan(x/2)^3 + (16*tan(x/2)^2)/3 + 2*tan(x/2) + 8/3)/(tan(x/2)^2 + 1)^2 - 5/3 pretty(y)
[f,s] = dsolve ('Dz=3*z+4*y', 'Dy=-4*z+3*y' , f cos(4*x)*exp(3*x) s sin(4*x)*exp(3*x)
3.7 TÌM GI I H N syms x a t h y=limit(sin(x)/x) % x 0 y 1 y=limit(sin(x)/x,inf) % x y 0 ans Inf ans -Inf limit((sin(x+h)-sin(x))/h,h,0) ans cos(x)
SIMULINK
Ghi chú
4.1.5 Làm vi c v i các lo i d li u double single int8 uint8 int16 uint16 int32 uint32 t tín
4.1.6 Làm vi c v i tín hi u ph c
Khi mô hì g con này vào:
MÔ HÌNH HOÁ
Ramp gán Initial output Gain i Sum
4.2.2 Mô hình hoá h n tính ph
- Algebric Constraint trong th Math ình
- Algebric Constraint trong th Math ình
- Math Function trong th Math 2
4.2.4 Mô hình hoá h th ng liên t n ình vi phân:
- Signal Generator trong th Sources
4.2.5 Mô hình hoá h c cao x''(t) + 3x'(t) +2x(t) = 4u(t) p 2 X(p) + 3pX(p) + 2X(p) = 4U(p)
- Transfer Fcn trong th Continuous n
4.2.6 Mô hình hoá h u ki u khác không a Ph ìn ình: x'(t) + x(t) = 0 t :
- State-Space trong th Continuous
4.2.7 Mô hình hóa h cho b kh i n sau:
- Transfer Fcn trong th ous
4.2.8 Mô hình hoá h phi tuy n a X Pol:
- Fcn trong th User Defined Function o hàm
- Mux trong th Signal Routing
- Fcn trong th User Defined Function
4.2.9 Ví d mv' = u bv hay v' = (u bv)/m k intergrator
Scope Sinks n Simulation > Configuration Parameters
Start Simulation > Start g msV(s) = U(s) bV(s)
Transfer Fcn Denominator coefficients thành [m b]
CÁC TOO
COMMUNICATION
5.1.1.1 Ngu n d li u, hi n th tín hi u eyediagram:
88 BÀI 5: nSamps = Fs/Rs; rolloff = 0.5; M = 4; qpskMod = comm.QPSKModulator; u ch QPSK rctFilt = comm.RaisedCosineTransmitFilter('RolloffFactor', rolloff, 'OutputSamplesPerSymbol', nSamps,'FilterSpanInSymbols', 6, 'Gain', 9.9121); rcrFilt = comm.RaisedCosineReceiveFilter('RolloffFactor', rolloff, 'InputSamplesPerSymbol', nSamps,'FilterSpanInSymbols', 6,
% T o tín hi u ch frameLen = 1000; msgData = randi([0 M-1],frameLen,1); msgSymbols = qpskMod(msgData); msgTx = rctFilt(msgSymbols);
% T o gi m t eyeObj = commscope.eyediagram('SamplingFrequency', Fs,
Signal','PlotType', '2D Line'); update(eyeObj, 0.5*msgTx);
Hình 5.2: -QAM biterr randi symerr tí i và SER wgn comm.GoldSequence comm.HadamardCode comm.KasamiSequence comm.BarkerCode comm.WalshCode comm.PNSequence
5.3: data = 2:2:12 mu_c = compand(data,255,max(data),'mu/compressor') % Mã hóa lu t mu_e = compand(mu_c,255,max(data),'mu/expander') % Gi i mã lu t a_c = compand(data,87.6,max(data),'a/compressor') % Mã hóa lu t A a_e = compand(a_c,87.6,max(data),'a/expander')% Gi i mã lu t A data = 2 4 6 8 10 12 mu_c = 8.1644 9.6394 10.5084 11.1268 11.6071 12.0000 mu_e = 2.0000 4.0000 6.0000 8.0000 10.0000 12.0000 a_c = 8.0713 9.5911 10.4802 11.1109 11.6002 12.0000 a_e = 2.0000 4.0000 6.0000 8.0000 10.0000 12.0000 dpcmdeco dpcmenco Mã hóa PCM vi phân dpcmopt
5.4 predictor = [0 1]; % y(k)=x(k-1) partition = [-1:.1:.9]; codebook = [-1:.1:1]; t = [0:pi/50:2*pi]; x = sawtooth(3*t); % Tín hi u g c
% ng t dùng DPCM encodedx = dpcmenco(x,codebook,partition,predictor); decodedx = dpcmdeco(encodedx,codebook,predictor); % Khôi ph c plot(t,x,t,decodedx,' ') legend('Original signal','Decoded signal','Location','NorthOutside'); distor = sum((x-decodedx).^2)/length(x)% L
5.5: So sánh t = [0:pi/50:2*pi]; x = sawtooth(3*t); % initcodebook = [-1:.1:1];
[predictor,codebook,partition] = dpcmopt(x,1,initcodebook);
% DPCM encodedx = dpcmenco(x,codebook,partition,predictor);
% decodedx = dpcmdeco(encodedx,codebook,predictor); distor = sum((x-decodedx).^2)/length(x)
5.4 huffmandict huffmanenco Mã hóa Huffman huffmandeco
5.6 symbols = 1:6; p = [.5.125.125.125.0625.0625]; dict = huffmandict(symbols,p); sig = randsrc(100,1,[symbols; p]);% T o d li u ng u nhiên comp = huffmanenco(sig,dict); % Mã hóa Huffman dsig = huffmandeco(comp,dict); % Gi i mã isequal(sig,dsig) % Ki m tra d li u sau khi gi i mã binarySig = de2bi(sig); seqLen = numel(binarySig)% Chi u dài chu i không mã hóa Huffman binaryComp = de2bi(comp); encodedLen = numel(binaryComp)% Chi u dài chu i mã hóa Huffman ans logical
1 seqLen 300 encodedLen 208 lloyds g dùng th quantiz
1 Mã CRC comm.CRCDetector: comm.CRCGenerator:
5.7: msg = randi([0 1],12,1); % T p ng u nhiên gen = comm.CRCGenerator([1 0 0 1],'ChecksumsPerFrame',2); codeword = step(gen,msg); % Thêm mã CRC detect = comm.CRCDetector([1 0 0 1],'ChecksumsPerFrame',2); %
[~, err] = step(detect,codeword) % Gi i mã và ki m tra codeword(end) = not(codeword(end)); % Gi l p 1 l i bit cu i
[~,err1] = step(detect,codeword) % Ki m tra l i err 0
2 Mã comm.BCHDecoder comm.BCHEncoder: mã hóa BCH comm.RSDecoder - Solomon comm.RSEncoder: mã hóa Reed - Solomon
94 BÀI 5: cyclgen cyclpoly decode encode gfweight gen2par hammgen bchdec bchenc: mã hóa BCH bchgenpoly bchnumerr mã BCH rsdec: ã Reed - Solomon rsenc: mã hóa Reed - Solomon rsgenpoly -Solomon rsgenpolycoeffs -Solomon
5.8: i cho mã vòng n = 7; % Chi u dài mã k = 4; % Chi p data = randi([0 1],k,1) % Th p ng u nhiên pol = cyclpoly(n,k);% T o ma tr n sinh và ma tr n ki m tra cho mã vòng parmat = cyclgen(n,pol); genmat = gen2par(parmat); encData = encode(data,n,k,'linear/binary',genmat);
RevData1 = encData; % D li u không sai decData1 = decode(RevData1,n,k,'linear/binary',genmat)
RevData2(3) = ~RevData2(3); % Sai 1 bit decData2 = decode(RevData2,n,k,'linear/binary',genmat)
S2 = RevData2'*parmat';S2 = mod(S2,2) % Vector s a sai
RevData3(1) = ~RevData3(1); decData3 = decode(RevData3,n,k,'linear/binary',genmat)
S3 = RevData3'*parmat';S3 = mod(S3,2) % Vector s a sai data = 1 1 0 1 decData1 = 1 1 0 1 decData2 = 1 1 0 1
3 Mã comm.TurboDecoder comm.TurboEncoder: mã hóa Turbo comm.ViterbiDecoder rbi convenc: Mã hóa c distspec vitdec Viterbi
5.9 t = poly2trellis([4 3],[4 5 17;7 4 2]); % T i cho mã ch p x = randi([0 1],100,1); code = convenc(x,t); decoded = vitdec(code,t,2,'trunc','hard'); biterr(x,decoded) % Ki m tra sai s
5.10 -QAM trong à không mã hóa
EbNoVec = (4:10)'; % Eb/No (dB) numSymPerFrame = 1000; % S symbol QAM symbols trên 1 frame berEstSoft = zeros(size(EbNoVec)); % Kh i t ng BER berEstHard = zeros(size(EbNoVec)); trellis = poly2trellis(7,[171 133]); % T i và chi u dài tbl = 32; rate = 1/2; for n = 1:length(EbNoVec) snrdB = EbNoVec(n) + 10*log10(k*rate); % Chuy n Eb/No sang SNR [numErrsSoft,numErrsHard,numBits] = deal(0); while numErrsSoft < 100 && numBits < 1e7
% T o d li u ng u nhiên dataIn = randi([0 1],numSymPerFrame*k,1);
% Mã hóa d li u dataEnc = convenc(dataIn,trellis);
% u ch QAM txSig = qammod(dataEnc,M,'InputType','bit');
% hi u qua kênh truy n có AWGN rxSig = awgn(txSig,snrdB,'measured');
% Gi u ch rxDataHard = qamdemod(rxSig,M,'OutputType','bit'); rxDataSoft = qamdemod(rxSig,M,'OutputType','approxllr', 'NoiseVariance',10.^(snrdB/10));
% Gi i mã Viterbi dataHard = vitdec(rxDataHard,trellis,tbl,'cont','hard'); dataSoft = vitdec(rxDataSoft,trellis,tbl,'cont','unquant'); numErrsInFrameHard = biterr(dataIn(1:end-tbl), dataHard(tbl+1:end)); numErrsInFrameSoft = biterr(dataIn(1:end-tbl), dataSoft(tbl+1:end)); numErrsHard = numErrsHard + numErrsInFrameHard; numErrsSoft = numErrsSoft + numErrsInFrameSoft; numBits = numBits + numSymPerFrame*k; end
% ng BER berEstSoft(n) = numErrsSoft/numBits; berEstHard(n) = numErrsHard/numBits; end
Hình 5.4 semilogy(EbNoVec,[berEstSoft berEstHard],'-*') hold on semilogy(EbNoVec,berawgn(EbNoVec,'qam',M)) legend('Soft','Hard','Uncoded','location','best') grid xlabel('Eb/No (dB)') ylabel('Bit Error Rate')
1 comm.GeneralQAMDemodulator ò comm.GeneralQAMModulator comm.PAMDemodulator -ary PAM
98 BÀI 5: comm.PAMModulator -ary PAM comm.RectangularQAMDemodulator comm.RectangularQAMModulator comm.CPFSKDemodulator comm.CPFSKModulator comm.CPMDemodulator comm.CPMModulator h comm.GMSKDemodulator comm.GMSKModulator comm.MSKDemodulator comm.MSKModulator comm.FSKDemodulator dùng M-ary FSK comm.FSKModulator -ary FSK comm.OFDMDemodulator comm.OFDMModulator comm.BPSKDemodulator comm.BPSKModulator comm.DBPSKDemodulator DBPSK comm.DBPSKModulator comm.DPSKDemodulator -ary DPSK comm.DPSKModulator -ary DPSK comm.DQPSKDemodulator comm.DQPSKModulator comm.OQPSKDemodulator: g comm.OQPSKModulator comm.PSKDemodulator -ary PSK comm.PSKModulator -ary PSK comm.QPSKDemodulator comm.QPSKModulator comm.GeneralQAMTCMDemodulator comm.GeneralQAMTCMModulator comm.PSKTCMDemodulator chòm sao M-ary PSK comm.PSKTCMModulator sao M-ary PSK comm.RectangularQAMTCMDemodulator comm.RectangularQAMTCMModulator i pamdemod pammod qamdemod qammod mskdemod mskmod fskdemod: fskmod dpskdemod dpskmod
100 BÀI 5: oqpskdemod oqpskmod pskdemod pskmod
M = 8; freqSep = 100; fskMod = comm.FSKModulator(M,freqSep); fskDemod = comm.FSKDemodulator(M,freqSep); ch = comm.AWGNChannel('NoiseMethod','Signal to noise ratio
(SNR)','SNR',-2); err = comm.ErrorRate; for counter = 1:100 data = randi([0 M-1],50,1); modSignal = step(fskMod,data); noisySignal = step(ch,modSignal); receivedData = step(fskDemod,noisySignal); errorStats = step(err,data,receivedData); end es = 'Error rate = %4.2e\nNumber of errors = %d\nNumber of symbols %d\n'; fprintf(es,errorStats)
5.12: fs = 1e3;ts = 1/fs;fd = 50; t = (0:ts:0.5-ts)'; x = sin(2*pi*4*t);
MOD = comm.FMModulator('SampleRate',fs,'FrequencyDeviation',fd); y = step(MOD,x); plot(t,[x real(y)]);
3 thông amdemod ammod fmdemod fmmod pmdemod pmmod ssbdemod
5.13 fs = 100; t = (0:1/fs:100)'; fc = 10; x = sin(2*pi*t); ydouble = ammod(x,fc,fs); ysingle = ssbmod(x,fc,fs); plot(ysingle); sa = dsp.SpectrumAnalyzer('SampleRate',fs, 'PlotAsTwoSidedSpectrum', false, 'YLimits',[-60 40]); step(sa,ysingle) plot(ydouble); sb = dsp.SpectrumAnalyzer('SampleRate',fs,
'PlotAsTwoSidedSpectrum',false, 'YLimits',[-60 40]); step(sb,ydouble)
5.1.1.5 Kênh truy n comm.AWGNChannel: kênh AWGN comm.RayleighChannel: kênh Rayleigh comm.RicianChannel: kênh Rician comm.MIMOChannel: kênh MIMO comm.LTEMIMOChannel: kênh LTEMIMO comm.MemorylessNonlinearity comm.PhaseNoise comm.ThermalNoise
5.14: 8-PSK qua kênh AWGN pskModulator = comm.PSKModulator; modData = pskModulator(randi([0 7],2000,1)); channel = comm.AWGNChannel('EbNo',20,'BitsPerSymbol',3); channelOutput = channel(modData);
104 BÀI 5: scatterplot(modData) scatterplot(channelOutput)
5.1.2.1 Ngu n d li u, hi n th tín hi u
General CRC Generator HDL Optimized
General CRC Syndrome Detector HDL Optimized:
Communications System Toolbox Support Package for RTL-SDR
ADS- õi máy bay Côn y cho phép mô hình -S Mode- phát m Mode 3A Mode-S (Select
-S xem thêm trong International Civil Aviation Organization, Annex 10, Volume 4 Surveillance and Collision Avoidance Systems
Mô hình - trong các -S có
118 BÀI 5: s s squitter s sau: ng , dung
Hình 5.19: -S userInput.Duration = 10; userInput.FrontEndSampleRate = 2.4e6; userInput.RadioAddress = '0'; userInput.LogFileName = 'adsb_messages.txt'; symbolDuration = 1e-6; chipsPerSymbol = 2; longPacketDuration = 112e-6; shortPacketDuration = 56e-6; preambleDuration = 8e-6;
% T o tín hi u ngu n bbFileName = 'adsb_capture_01.bb'; sigSrc = comm.BasebandFileReader(bbFileName); frontEndSampleRate = sigSrc.SampleRate; adsbParam.isSourceRadio = false; adsbParam.FrontEndSampleRate = frontEndSampleRate; chipRate = chipsPerSymbol/symbolDuration;
[n,d]=rat(frontEndSampleRate/chipRate); if d>2 interpRate = d; else if n Flip Block Ctrl+I r 2 L = 2.49 uán tính:
- Joints, kéo v Revolute vào mô hình
Revolute Ctrl+I Body Ground Current base
Angle, Angular Velocity Output selected parameters as one signal
- Simulink Browser Library Mux Signal
Routing), Scope, XY Graph Sinks
Solver Relative tolerance thành 1e-6, Absolute tolerance thành 1e-4, Max step size thành 0.2, Stop time thành inf
XY Graph xmin = 0, xmax = 200, ymin = -500, ymax = 500
Start Simulation ng Double click
C box Display Machines after updating diagram và Show animation during simulation
Machine of model: spen Model > Body Geometries > Ellipsoids
CONTROL SYSTEM
5.3.1.1 n tf zpk - không ss frd pid pidstd pid2 ong song pidstd2 pade Padé absorbDelay z = 0 thiran Thiran totaldelay th LTI delayss
H1 = tf(num,den); subplot(311);step(H1);title('Transfer function'); z = 0; p = [-1+3*i -1-3*i]; m c c k = 1; l i
H2 = zpk(z,p,k); subplot(312);step(H2);title('Zero-pole-gain');
A = [ -2 -10 ; 1 0 ]; B = [ 1 ; 0 ]; C = [ 1 0 ]; D = 0; H3 = ss(A,B,C,D); subplot(313);step(H3);title('State-space');
Hình 5.63: các mô hình feedback
H = lft(H1,H2) connect sumblk c series parallel lft Redheffer
Sum2 = sumblk('u = uC + uF'); i ("u" và "y" là ngõ vào và ngõ ra) F.u = 'r'; F.y = 'uF';
T = connect(F,C,G,S,Sum1,Sum2,'r','ym'); step(T), grid
5.3.2 Phân tích h th ng step stepinfo impulse initial lsim t k lsiminfo gensig bode Bode bodemag nyquist Nyquist nichols Nichols sigma iá t ng evalfr dcgain LTI
H = H2*H1; t = 0:0.01:4; u = exp(-t); % Ngõ vào v = lsim(F,u,t); % Ngõ ra c a H1 y = lsim(G,v,t); % L y ngõ ra H1 -> H2 và tính ngõ ra c a H2 y1 = lsim(H,u,t); % Ngõ ra c a h th subplot(121);plot(t,y); subplot(122);plot(t,y1);
5.28 s = tf('s'); H = (s^2+2*s+3)/(s^3+2*s^2+10); figure;bode(H);grid figure;nyquist(H);grid figure;nichols(H);grid
5.31: PID Tuner cho mô hình
G = zpk(-5,[-1 -2 -3 -4],6,'OutputDelay',1); pidtool(G,'pi'); %Thi t k b u khi n PI
Click Add Plot input disturbance rejection
Hình 5.78: t1 = 21.8; t2 = 36.0; tau = 3/2 * ( t2 - t1 ) theta = t2 - tau; s = tf('s');
Kc = 0.859 * (theta / tau)^(-0.977) tauc = ( tau / 0.674 ) * ( theta / tau )^0.680
168 BÀI 5: step(Tfb), grid on title('Response to step change in temperature setpoint T_{sp}') ylabel('Tank temperature') margin(Gp*C), grid
C1 = 0.9 * (1 + 1/(tauc*s)); % gi m Kc t n 0.9 margin(Gp*C1), grid step(Tfb,'b', feedback(ss(Gp*C1),1),'r') legend('Kc = 1.23','Kc = 0.9')
Tff = Gp * ss(F) + Gd; step(Tff), grid
Tffb = connect(Gp,Gd,C,F,Sum1,Sum2,Sum3,{'Tsp','d'},'T');
Tfb = connect(Gp,Gd,C,Sum1,Sum3,{'Tsp','d'},'T'); step(Tfb,'b',Tffb,'r '), grid title('Closed-loop response to setpoint and disturbance step change') ylabel('Tank temperature') legend('Feedback only','Feedforward + feedback') bodemag(Tfb,'b',Tffb,'r ',{1e-3,1e1}) legend('Feedback only','Feedforward + feedback')
5.3.4 Thi t k h th u khi n dùng Control System Designer Control System Designer cho phép:
Step Response Design Requirements > New
Root Locus Editor Add Pole/Zero > Integrator
- Add Pole/Zero > Real Zero
MatLab ystem dùng cho sinh viên ngàn -
Câu 1: i u khi n có hàm truy n
Câu 3: Dùng công c Simscape Multibody mô ph ng c ch 4 thanh sau: au:
Câu 4: Dùng Simulink mô ph ng ho t ng i u ch thông d i nh sau: