http://www.ebook.edu.vn L ô ø i c a û m ô n K ính göû i Thaà y TS. Chung T aá n L aâ m ! Em l aø Phan LeâSôn, si nh vi eâ n naê m 4, ngaø nh Cô Ñi eä n Töû, Tröôø ng Ñaï i Hoï c Baù ch K hoa Tp. HCM . Hoï c kyø naø y, em raá t vi nh döï ñöôï c thöï c hi eä n ñeà taø i cuû a ñoà aù n moân hoï c Thi eá t K eá HeäThoá ng Cô Ñi eä n T öû döôù i söï höôù ng daã n t aä n t ình cuû a Thaà y. Chính söï nhieä t tình ch æ d aã n cu û a T h aà y ñ aõg i u ù p e m h o aø n th aø n h ñoàaù n k h aùto á t, ñ aï t ñö ô ï c nhö õ n g ye âu c aà u c ô b aûn maø ñ e à taø i ñ aë t ra. V aøc u õ n g q u a ñ o ù , e m ñaõ h o ï c h o û i , ti e áp c aän ñ ö ô ï c nhi eà u v aá n ñeà thöï c t eá hôn, boå sung nhöõ ng “ khe hôû ” ki eá n t höù c do v i eä c hoï c t hi eâ n veà l yù thuyeá t ñeå l aï i. Em xi n c h aân th aø nh caûm ô n Th aà y. Cuõ ng qua ñaâ y, em xi n göû i l ôø i caûm ôn chaâ n thaø nh cuû a mình ñeán gi a ñình, baï n beø –nhöõ ng ngöôø i ñaõñoä ng vi eâ n, quan taâ m heá t möï c ñeá n em trong suoá t quaùtrình th ö ï c h i e ä n ñ o à aù n . Ño ù l aø n h ö õn g ñ oä n g l ö ïc th u ù c ñ aå y e m c o ágaé n g h ô n , quye á t taâ m h ô n , ñ e å c uo á i c u ø n g em co ù ñ ö ô ï c k e á t quaû n h ö ng aø y h o â m nay . Em xin g ö û i lô ø i c aû m ôn ñ e án taá t c aû .
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
1. Giớ i thiệu về QuadroCopter 2. Cấu tạo của QuadroCopter 3. Nguyên lý hoạt động của QuadroCopter 4. Xây dựng mô hình QuadroCopter trong VisualNastran5. Xây dựng mô hình điều khiển QuadroCopter trong Simulink của MatLab6. Lyùthuyeát veàboäloïc Kalman 7. ÖÙng duïng boäloïc Kalman vaøo ño caùc goùc nghieâng cuûa maùy bay 8. Höôùng phaùt trieån cuûa ñeàtaøi . 9. PhuïLuïc
II. CẤU TẠO CỦA QUADROCOPTER :- Thân : thườ ng có hình dáng giống dấu chữ thậ p , mỗi cánh của chữ thậ p đỡ một
cánh của máy bay.
- Cánh : có 4 cánh giống hệt nhau đặt trên 4 góc của thân , 2 cánh đối diện thì quaycùng chiều nhau và ngượ c chiều vớ i 2 cánh đối diện còn lại . Sở d ĩ máy bay cócấu tạo như vậy để làm hạn chế sự quay của thân khi cánh quay.
- Bộ điều khiển : bao gồm 2 phần , 1 phần đặt trên máy bay , một phần nằm ở dướ iđất .+ Phần đặt trên máy bay : bao gồm mạch công suất điều khiển 4 động cơ , mạchtruyền sóng để k ết nối vớ i bộ điều khiển ở dướ i đất , mạch chính dùng để điềukhiển chuyển động của động cơ ( có thể bao gồm cả 2 phần là bằng tay và tự động
) . Để điều khiển máy bay theo chế độ tự động ta còn phải có thêm các cảm biếnnhư cảm biến gyro để đo độ nghiêng, cảm biển aùp suaát để đo độ cao , cảm biểngia tốc để biết hướ ng chuyển động , camera xử lý ảnh có nhiệm vụ theo dõi cácđối tượ ng ở dướ i đất . . .+ Phần dướ i đất : bao gồm bộ điều khiển bằng tay có mạch thu phát tín hiệu sóngvô tuyến, mạch k ết nối vớ i máy tính hoặc là mạch giao tiế p vớ i ngườ i sử dụng để họ có thể thay đổi các thông số và các chế độ điều khiển . . .
- Động cơ và bộ driver của động cơ : nếu máy bay chỉ hoạt động bay thôngthườ ng thì chỉ cẩn bốn động cơ dùng cho 4 cánh quạt là đủ.
Hình 2: Moâhình QuadroCopter
III. NGUYEÂN LYÙHOAÏT ÑOÄNG CUÛA QUADROCOPTER:
Ñeåñieàu khieån ñöôïc hoaït ñoäng cuûa maùy bay ta phaûi ñieàu khieån tyûleåtoác ñoä
Bay theo moät höôùng :- Giöõnguyeân toác ñoä2 caùnh theo höôùng khoâng dòch chuyeån .- Taêng toác ñoäcaùnh naèm ôûgoác vector theo phöông dòch chuyeån .- Giaûm toác ñoäcaùnh naèm ôûñænh vector theo phöông dòch chuyeån .
Hình 4 : Ñieàu khieån maùy bay bay theo 1 höôùng
Khi chuùng ta giöõnguyeân toác ñoä2 caùnh theo phöông khoâng dòch chuyeån va taêng, giaûmtoác ñoä2 caùnh theo phöông dòch chuyeån khi ñoùchuùng ta seõtaïo cho maùy bay moät goùc
Nhiệm vụ của phaàn naøy là xây dựng một mô hình điều khiển máy bay QuadroCopter . Nếu ta muốn điều khiển hướ ng di chuyển của QuadroCopter thì tr ướ c tiên ta phải điểukhiển đượ c độ nghiêng của máy bay theo 2 phươ ng x , y ( oxy là mặt phẳng song song
Nếu ta muốn cho máy bay nghiêng theo phươ ng X thì ta phải thay đổi tỷ lệ vận tốc củacánh A và cánh C ( sự thay đổi vận tốc tươ ng ứng vớ i sự thay đổi lực nâng và lực vuônggóc vớ i tr ục ) . Tươ ng tự nếu ta muốn thay đổi góc nghiêng theo phươ ng Y thì ta phảithay đổi tỷ lệ vận tốc của 2 cánh B và D .
Công thức liên hệ giữa lực nâng F ( vuông góc vớ i mặt phẳng chứa cánh quạt ) và vận tốcgốc ω của máy bay là :
F = k.ω2 vớ i k là hằng số phụ thuộc vào môi tr ườ ng và cấu tạo của cánh máy bay .
Mô hình điều khiển đượ c xây dựng trên môi tr ườ ng Simulink của MatLab k ết hợ p vớ iVisualNastran .
Dướ i đây là mô hình điều khiển độ nghiêng của máy bay :
Sơ đồ điều khiển trên bao gồm 3 phần :- Phần có khối Controller dùng để điều khiển độ nghiêng theo phươ ng X .- Phần có khối Controller1 dùng để điều khiển độ nghiêng theo phươ ng Y .- Phaàn coùkhoái control ler2 duøng ñeåñieàu khieån ñoäcao theo phöông Z .
Do 2 khối ñaàu tươ ng tự như nhau nên ta chỉ cần chỉ ra các khối con trong 1 khối làđủ:
- Khối Step : chung cho cả 2 khối lớ n , đây là khối tạo ra giá tr ị tham khảo
về độ nghiêng của máy bay theo 2 phươ ng X, Y
Giá tr ị tham khảo của góc nghiêng đượ c cho như đồ thị sau :
- Khối : Dùng để lượ ng tử hoá tín hiệu đầu vào và giữ nó
trong một chu k ỳ tính toán .
- Khối hàm truyền của động cơ : tín hiệu đầu vào là điện áp , tín hiệu đầu ra là vận
tốc góc .
- Khối bão hoà và khối giớ i hạn mức tăng nhằm giữ cho tín hiệu đầu ra nằm trongkhoảng giớ i hạn vật lý cho phép của mô hình .
- Khối tính toán : vớ i đầu vào là độ thay đổi vận tốc gốc và đầu ra là sự phân chia
sự thay đổi giá tr ị đầu vào của vận tốc gốc cho 2 cánh .
Nội dung trong khối này như sau:function y = fcn(u)% This block supports an embeddable subset of the MATLAB language.% See the help menu for details.y1= (u+sqrt(16-u*u))/2;
- Khối hàm truyền từ vận tốc gốc sang lực vuông góc vớ i cánh :
- Khối VisualNastran :
Khối này gồm 4 đầu vào đó là lực nâng của 4 cánh quạt . Đầu ra là độ nghiêng của máy bay theo phươ ng X và Y . Nếu muốn có cánh quạt quay để hình ảnh mô phỏng tr ực quan gần vớ i thực tế hơ n ta cóthể thêm vào 4 đầu vào vận tốc cho khối VisualNastran .
YÙtöôûng xaây döïng khoái naøy laøtöøgoùc nghieâng ño veàta so saùnh vôùi giaùtròtham khaûoñeåñöa ra sai soágoùc nghieâng , töøsai soágoùc nghieâng ta ñöa vaøo khoái PID tính ra ñöôïcmöùc vol cheânh leäch caàn ñöa vaøo ñeåñieàu khieån 2 caùnh quaït . Töømöùc Vol naøy , sau khiqua haøm truyeàn cuûa ñoäng cô ta ñöôïc möùc cheânh leäch vaän toác cuûa 2 caùnh quaït . Sau ñoùta ñöa ñoächeânh leäch naøy vaøo khoái chia vaän toác cho moãi ñoäng cô sao cho hôïp lyùnhaát.
Sau đây là k ết quả mô phỏng đượ c thể hiện trên VisualNastran :
Đồ thị trên biểu diễn góc nghiêng của máy bay theo phươ ng X và Y theo thờ i gian ( giátr ị max và min của đồ thị góc trên là từ - 90 0 đến 90 0 ) .Trong đồ thị ta thấy trong 5 s đầu góc tươ ng ứng theo 2 phươ ng hướ ng tớ i tr ạng thái ổnđịnh ( 00 ) và sau 5 s thì góc nghiêng chuyển sang 180 . Để thấy đượ c k ết quả của luậtđiều khiển ta so sánh đồi thị trên vớ i đồ thị giá tr ị tham khảo của khối Step đã đượ c đưara trong phần khối Step . K ết quả mô phỏng bằng hình ảnh cho ta thấy ban đầu ( trong 5sđầu ) 2 góc của máy bay là 00 tươ ng ứng vớ i việc giữ thăng bằng trên không của máy bay. Và sau 5s góc điều khiển theo 2 phươ ng là 180 nên ta thấy đượ c đáp ứng của máy bay là
thay đổi hướ ng ngay lậ p tức ứng vớ i phươ ng nghiêng điều khiển.
Khoái ñieàu khieån ñoäcao :
Söïkhaùc bieät cuûa khoái ñieàu khieån ñoäcao so vôùi 2 khoái kia laøôûchoã, trong moãi khoáiñieàu khieån goùc nghieâng chætaùc ñoäng ñeán 2 caùnh quaït töông öùng vôùi goùc nghieâng ñoù.Coøn trong khoái ñieàu khieån ñoäcao thì taùc ñoäng 1 luùc leân 4 caùnh quaït . Cuïtheånhö sau,sau khi ñoïc giaùtròñoäcao veàta so saùnh vôùi giaùtròtham khaûo thì thu ñöôïc sai soáñoäcao. Sai soánaøy ñöôïc ñöa qua khoái PID ñeåtính ra toång möùc Vol caàn thay ñoåi . Giaùtrònaøy
laïi laøñaàu vaøo cuûa khoái moâhình hoaùñoäng cô , ñaàu ra cuûa khoái moâhình hoaùñoäng côchính laøvaän toác caàn thay ñoåi . Vaän toác naøy ñöôïc chia ñeàu cho 4 caùnh quaït ñeåñaûm baûo
khoâng gaây aûnh höôûng nhieàu tôùi ñoänghieâng .
Ñeåvieäc moâphoûng ñöôïc tröïc quan hôn vaødeãsöûduïng hôn nhoùm ñaõthieât keágiao dieänvôùi ngöôøi duøng trong moâi tröôøng Matlab :
Hình veõgiao dieän ñieàu khieån maùy bay moâhìnhGiao dieän coùcaùc thanh tröôït vaøcaùc Edit box ñeångöôøi duøng coùtheånhaäp giaùtròñieàukhieån vaøo maùy bay hoaëc quan saùt caùc giaùtròño ñöôïc töømaùy bay .Caùc thanh tröôït X , Y laøñeåñieàu khieån goùc nghieâng theo phöông X vaøY .
Thanh tröôït Z duøng ñeåñieån khieån ñoäcao theo phöông Z .Caùc thanh tröôït V1, V2, V3, V4 laøduøng ñeåñieàu khieån vaän toác cuûa caùc caùnh A, B, C,D cuûa maùy bay .Phaàn Code cuûa giao dieän ñöôïc ñeåôûphaàn phuïluïc .
raèng A thay ñoåi ñoái vôùi töøng traïng thaùi nhöng ôûñaây ta giaûsöûA khoâng ñoåi. Ma traän Bnxl bieåu dieãn quan heägiöõa bieán ñieàu khieån ngoõvaøo vaøtraïng thaùi. Ma traän H mxnbieåu dieãn quan heägiöõa giaùtròño vaøtraïng thaùi cuûa quaùtrình. Trong thöïc theá, H thayñoåi nhöng ta giaûsöûH khoâng ñoåi.
Trong quaùtrình thöïc thi thöïc teácuûa boäloïc, ma traän covariance cuûa nhieãu thieátbòño R ñöôïc xaùc ñònh tröôùc. R ñöôïc ño off_l ine baêng caùch cho moät soágiaùtròño maãu,
khaûo saùt vaøxaùc ñònh söïbieán ñoåi cuûa nhieãu ño. Ta cuõng coùtheåxaùc ñònh Q töøthöïcnghieäm nhöng khoùkhaên hôn nhieàu bôûi vì ñoâi khi ta khoâng theåquan saùt ñöôïc tröïc tieápquaùtrình ñang xaûy ra.
Q vaøR chính laøhai thoâng soáñeåhieäu chænh boäloïc Kalman . Quaùtrình hieäuchænh thöôøng ñöôïc thöïc hieän of f_l ine .
3. Moâhình hoaùgyr o:
Gyro laøcaûm bieán ño vaän toác goùc .Goùc nghieâng theo phöông x cuûa maùy bay ôûtraïng thaùi hieän taïi baèng goùc theo
phöông x ôûtraïng thaùi tröôùc coäng vôùi tích phaân cuûa vaän toác goùc. Ta coùphöông trìnhsau:
4. Thieát keásô ñoàmaïch nguyeân lyùcuûa gyr o vaøacceler ometer
Caûm bieán gia toác maønhoùm söûduïng laøcaûm bieán gia toác 3 truïc , coùnghóa laøvôùi caûmbieán accelerometer naøy coùtheåño ñöôïc gia toác theo 3 phöông X, Y, Z .
g-select2
X_
D A T A
3.3V_1
U1
MMA7260
1234
5 6 7 8
9101112
1 3
1 4
1 5
1 6
g-Select1g-Select2VDDVSS
N C 1
N C 2
N C 3
N C 4
NC 5NC 6NC 7
~sleep_mode
Z O U T
Y O U T
X O U T
N C 8
Z_
D A T A
g-select1
Y_
D A T A
ZOUT
R3
1K
YOUT
Z_DATA
C4
0.1uF
XOUT
Y_DATA
R2
1k
C3
0.1uF
C5
0.1uF
R1
1k
X_DATA
Sô ñoànguyeân lyùcaûm bieán gia toác
Caûm bieán MMA7260 caàn nguoàn cung caáp laø3.3 V . Caùc chaân chuùng ta söûduïng ôûñaâylaøchaân g-Select1 ( chaân soá1) , g-Select2 ( chaân soá2 ) duøng ñeåchoïn cheáñoähoaït ñoängcaûm bieán . Ba chaân döõlieäu XOUT (15), YOUT (14), ZOUT (13) laø3 chaân ñöa ra möùcVol tyûleävôùi gia toác theo 3 phöông X, Y, Z .
Treân moâhình thí nghieäm nhoùm söûduïng 2 caûm bieán gyro ño theo phöông X vaøY.
5V
3.3V_1
U6
Gyro
1 2
3 4
5 6
5V NC
3.3V C+
GN D D ATADATA1
C1
C
Sô ñoànguyeân lyùcaûm bieán gyro
Caûm bieán gyro caàn 2 nguoàn cung caáp : 1 nguoàn laø3.3 V , moät nguoàn laø5 V . Moät chaândöõlieäu cho ra möùc Vol tyûleävôùi vaän toác goùc theo phöông maøgyro ño .
Code chöông trình thieát keágiao dieän baèng phaàn meàm MatLab
function varargout = GUI1(varargin)% GUI1 M-f ile for GUI1.fig% GUI1, by itself, creates a new GUI1 or raises the existing% singleton*.%% H = GUI1 returns the handle to a new GUI1 or the handle to% the existing singleton* .
%% GUI1('CALLBACK',hObject,eventData,handles,...) calls the local% function named CALLBACK in GUI1.M with the given input arguments.%% GUI1('Property','Value',...) creates a new GUI1 or raises the% existing singleton* . Starting from the left, property value pairs are% applied to the GUI before GUI1_OpeningFunction gets called. An% unrecognized property name or invalid value makes property application% stop. All inputs are passed to GUI1_OpeningFcn via varargin.%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one% instance to run (singleton)".%% See also: GUIDE, GUIDATA, GUIHANDLES
% Copyright 2002-2003 The MathWorks, Inc.
% Edit the above text to modify the response to help GUI1
% Last Modified by GUIDE v2.5 28-Feb-2008 13:00:33
% Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct('gui_Name', mfi lename, ...
if nargin && ischar(varargin{1})gui_State.gui_Callback = str2func(varargin{ 1} );
end
if nargout[varargout{ 1:nargout} ] = gui_mainfcn(gui_State, varargin{ :} );
elsegui_mainfcn(gui_State, varargin{ :} );
end% End initialization code - DO NOT EDIT% --- Executes just before GUI1 is made visible.function GUI1_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.% hObject handle to figure% eventdata reserved - to be defined in a future version of MATLAB% handles structure wi th handles and user data (see GUIDATA)% varargin command line arguments to GUI1 (see VARARGIN)
% Choose default command line output for GUI1handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes GUI1 wait for user response (see UIRESUME)% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.function varargout = GUI1_OutputFcn(hObject, eventdata, handles)% varargout cell array for returning output args (see VARARGOUT);% hObject handle to figure% eventdata reserved - to be defined in a future version of MATLAB% handles structure wi th handles and user data (see GUIDATA)
% Get default command line output f rom handles structurevarargout{ 1} = handles.output;
% --- Executes on slider movement.function sliderX_Callback(hObject, eventdata, handles)x=get(handles.sliderX,'value');
set_param('son1/StepX','After',num2str(get(handles.sliderX,'value')/10000));% hObject handle to sliderX (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure wi th 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
% --- Executes during object creation, after setting all properties.
function sliderX_CreateFcn(hObject, eventdata, handles)% hObject handle to sliderX (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background, change% 'usewhitebg' to 0 to use default. See ISPC and COMPUTER.usewhitebg = 1;if usewhitebg
% --- Executes on slider movement.function sliderY_Callback(hObject, eventdata, handles)Y=get(handles.sliderY,'value');Y=num2str(Y);set(handles.editY,'string',Y);set_param('son1/StepY','After',num2str(get(handles.sliderY,'value')/10000));% hObject handle to sliderY (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure wi th 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
% --- Executes during object creation, after setting all properties.function sliderY_CreateFcn(hObject, eventdata, handles)
% hObject handle to sliderY (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background, change% 'usewhitebg' to 0 to use default. See ISPC and COMPUTER.usewhitebg = 1;if usewhitebg
% --- Executes on slider movement.function sliderZ_Callback(hObject, eventdata, handles)Z=get(handles.sliderZ,'value');Z=num2str(Z);set(handles.editZ,'string',Z);% hObject handle to sliderZ (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB% handles structure wi th 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
% --- Executes during object creation, after setting all properties.function sliderZ_CreateFcn(hObject, eventdata, handles)% hObject handle to sliderZ (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background, change% 'usewhitebg' to 0 to use default. See ISPC and COMPUTER.usewhitebg = 1;if usewhitebg
function editx_Callback(hObject, eventdata, handles)% hObject handle to editx (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure wi th handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of editx as text% str2double(get(hObject,'String')) returns contents of editx as a double
% --- Executes during object creation, after setting all properties.function editx_CreateFcn(hObject, eventdata, handles)% hObject handle to editx (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.
function editY_Callback(hObject, eventdata, handles)% hObject handle to editY (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure wi th handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of editY as text% str2double(get(hObject,'String')) returns contents of editY as a doubley=get(handles.editY,'string');y=str2num(y);set(handles.sliderY,'value',y);
% --- Executes during object creation, after setting all properties.
function editY_CreateFcn(hObject, eventdata, handles)% hObject handle to editY (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc
function editZ_Callback(hObject, eventdata, handles)% hObject handle to editZ (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure wi th handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of editZ as text% str2double(get(hObject,'String')) returns contents of editZ as a double
% --- Executes during object creation, after setting all properties.function editZ_CreateFcn(hObject, eventdata, handles)% hObject handle to editZ (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc
% --- Executes on slider movement.function sliderV1_Callback(hObject, eventdata, handles)
% hObject handle to sliderV1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure wi th 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 sliderV1=get(handles.sliderV1,'value');V1=num2str(V1);set(handles.editV1,'string',V1);set_param('son1/Pulse
% --- Executes during object creation, after setting all properties.function sliderV1_CreateFcn(hObject, eventdata, handles)% hObject handle to sliderV1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background, change% 'usewhitebg' to 0 to use default. See ISPC and COMPUTER.
% --- Executes on slider movement.function sliderV2_Callback(hObject, eventdata, handles)% hObject handle to sliderV2 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure wi th 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 sliderV2=get(handles.sliderV2,'value');V2=num2str(V2);set(handles.editV2,'string',V2);
% --- Executes during object creation, after setting all properties.function sliderV2_CreateFcn(hObject, eventdata, handles)% hObject handle to sliderV2 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background, change% 'usewhitebg' to 0 to use default. See ISPC and COMPUTER.
% --- Executes on slider movement.function sliderV3_Callback(hObject, eventdata, handles)
% hObject handle to sliderV3 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure wi th 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 sliderV3=get(handles.sliderV3,'value');V3=num2str(V3);set(handles.editV3,'string',V3);set_param('son1/PulseGenerator3','Amplitude',num2str(1000*get(handles.sliderV3,'value')));
% --- Executes during object creation, after setting all properties.function sliderV3_CreateFcn(hObject, eventdata, handles)% hObject handle to sliderV3 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called
function editv1_Callback(hObject, eventdata, handles)
% hObject handle to editv1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure wi th handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of editv1 as text% str2double(get(hObject,'String')) returns contents of editv1 as a double
% --- Executes during object creation, after setting all properties.function editv1_CreateFcn(hObject, eventdata, handles)
% hObject handle to editv1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc
function editv2_Callback(hObject, eventdata, handles)% hObject handle to editv2 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure wi th handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of editv2 as text% str2double(get(hObject,'String')) returns contents of editv2 as a double
% --- Executes during object creation, after setting all properties.function editv2_CreateFcn(hObject, eventdata, handles)% hObject handle to editv2 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.
function editv3_Callback(hObject, eventdata, handles)% hObject handle to editv3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB% handles structure wi th handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of editv3 as text% str2double(get(hObject,'String')) returns contents of editv3 as a double
% --- Executes during object creation, after setting all properties.function editv3_CreateFcn(hObject, eventdata, handles)% hObject handle to editv3 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc
% --- Executes on slider movement.function sliderV4_Callback(hObject, eventdata, handles)% hObject handle to sliderV4 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure wi th 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 sliderV4=get(handles.sliderV4,'value');
% --- Executes during object creation, after setting all properties.function sliderV4_CreateFcn(hObject, eventdata, handles)% hObject handle to sliderV4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background, change% 'usewhitebg' to 0 to use default. See ISPC and COMPUTER.usewhitebg = 1;if usewhitebg
function editV4_Callback(hObject, eventdata, handles)% hObject handle to editV4 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure wi th handles and user data (see GUIDATA)
% --- Executes during object creation, after setting all properties.function editV4_CreateFcn(hObject, eventdata, handles)% hObject handle to editV4 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc
function editV1_Callback(hObject, eventdata, handles)% hObject handle to editV1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure wi th handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of editV1 as text% str2double(get(hObject,'String')) returns contents of editV1 as a double
% --- Executes during object creation, after setting all properties.function editV1_CreateFcn(hObject, eventdata, handles)% hObject handle to editV1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called
function editV3_Callback(hObject, eventdata, handles)% hObject handle to editV3 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure wi th handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of editV3 as text% str2double(get(hObject,'String')) returns contents of editV3 as a double
% --- Executes during object creation, after setting all properties.function editV3_CreateFcn(hObject, eventdata, handles)% hObject handle to editV3 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc
function editV2_Callback(hObject, eventdata, handles)% hObject handle to editV2 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure wi th handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of editV2 as text% str2double(get(hObject,'String')) returns contents of editV2 as a double
% --- Executes during object creation, after setting all properties.function editV2_CreateFcn(hObject, eventdata, handles)% hObject handle to editV2 (see GCBO)
function editX_Callback(hObject, eventdata, handles)
% hObject handle to editX (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure wi th handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of editX as text% str2double(get(hObject,'String')) returns contents of editX as a doublex=get(handles.editX,'string');x=str2num(x);set(handles.sliderX,'value',x);
% --- Executes during object creation, after setting all properties.function editX_CreateFcn(hObject, eventdata, handles)% hObject handle to editX (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc
/** Ma traän covariance , ma traän naøy ñöôïc caäp nhaäp sau moãi chu kyøtính* Ma traän naøy laøma traän covarian sai soátröôùc khi tính* /static float P[2][2] = {