1. Trang chủ
  2. » Cao đẳng - Đại học

Slide CAD bai3 matlab

34 32 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

23/09/2016 MatLab R2013b Cài đặt Các vấn đề Mô Simulink Mô mã lệnh Cài đặt Bước 1: Chạy file Setup.exe, chọn Install without using Internet Bước 2: Chọn I have the File Installation Key for my license nhập key 12345678901112131415 Bước 3: Khi hỏi file license, đến file license.dat thư mục CYGiSO Bước 4: Copy file dll thư mục CYGiSO đè lên file có thư mục cài đặt MatLab (x64 Win 64 bit, x86 Win 32 bit) 23/09/2016 MatLab R2013b Cài đặt Các vấn đề Mô Simulink Mô mã lệnh Các tools cài đặt Simulink Cửa sổ lệnh 23/09/2016 Chọn New > Graphical User Interface để tạo giao diện cho chương trình Chọn Blank GUI Các đối tượng tạo giao diện Vùng thiết kế 23/09/2016 Các đối tượng tạo giao diện Push Button: Edit Text: ô nhập liệu Radio Button: Pop-up Menu: Slider: Check box: List Box: Static Text: văn tĩnh Axes: trục toạ độ 23/09/2016 Chọn Tools > Menu Editor để tạo menu 10 23/09/2016 Tạo menu sau: Label Tag Label Tag File mnuFile Exit mnuExit Help mnuHelp About mnuAbout 11 Thiết kế giao diện sau: Để chọn thuộc tính đối tượng, double-click vào đối tượng để mở cửa sổ Inspector 12 23/09/2016 Các thuộc tính cần ý: String: giá trị hiển thị đối tượng Tag: tên đối tượng, dùng để phân biệt với đối tượng khác FontName: tên font văn đối tượng FontSize: kích thước font Unit: đơn vị xác định vị trí đối tượng, nên chọn normalized Value: giá trị đối tượng, dùng cho đối tượng Popup-menu, List Box, Radio Button, Check Box, Slider Callback: mã lệnh thực tác động lên đối tượng (nên dùng file m để hiệu chỉnh mã lệnh) 13 Đối tượng Nút nhấn Radio Button Static text Static text Slider Edit text Edit text Thông số String: Convert Tag: pushbuttonConvert String: Celcius, Rankine, Kelvin Value: 1.0, 0.0, 0.0 Tag: radiobuttonC, radiobuttonR, radiobuttonK String: Fahrenheit degree String: Celcius degree Tag: text2 Max: 9032 Min: -459.4 SliderStep: [0.001 0.1] Tag: SliderDoF String: 32 Tag: editDoF String: Tag: editKQ 14 23/09/2016 Nhấn Save lưu file: nhận tên vd1 Cửa sổ soạn mã lệnh ra: 15 Dùng Go To chuyển đến đối tượng mong muốn: 16 23/09/2016 function handles) pushbuttonConvert_Callback(hObject, % hObject handle to pushbuttonConvert (see GCBO) % eventdata MATLAB % handles GUIDATA) eventdata, reserved - to be defined in a future version of structure with handles and user data (see doF = str2num(get(handles.editDoF,'String')); if get(handles.radiobuttonC,'Value') == set(handles.editKQ,'String',num2str((doF-32)*5/9)); elseif get(handles.radiobuttonR,'Value') == set(handles.editKQ,'String',doF+459.7); else set(handles.editKQ,'String',(doF-32)*5/9+273.15); end 17 function radiobuttonC_Callback(hObject, eventdata, handles) % hObject % eventdata MATLAB % handles GUIDATA) % Hint: radiobuttonC handle to radiobuttonC (see GCBO) reserved - to be defined in a future version of structure with get(hObject,'Value') handles returns and user toggle data state (see of set(handles.radiobuttonK,'Value',0); set(handles.radiobuttonR,'Value',0); set(handles.text2,'String','Celcius degree'); 18 23/09/2016 function radiobuttonR_Callback(hObject, eventdata, handles) % hObject % eventdata MATLAB % handles GUIDATA) % Hint: radiobuttonR handle to radiobuttonR (see GCBO) reserved - to be defined in a future version of structure with handles and user data (see get(hObject,'Value') returns toggle state of set(handles.radiobuttonC,'Value',0); set(handles.radiobuttonK,'Value',0); set(handles.text2,'String','Rankine degree'); 19 function radiobuttonK_Callback(hObject, eventdata, handles) % hObject % eventdata MATLAB % handles GUIDATA) % Hint: radiobuttonK handle to radiobuttonK (see GCBO) reserved - to be defined in a future version of structure with handles and user data (see get(hObject,'Value') returns toggle state of set(handles.radiobuttonR,'Value',0); set(handles.radiobuttonC,'Value',0); set(handles.text2,'String','Kelvin degree'); 20 10 23/09/2016 v = v1dt  v1 = v' Simulink > Continuous > Integrator Simulink > Math > Gain v' bv v' = (u – bv)/m u – bv bv u 39 Simulink > Sources > Step 40 20 23/09/2016 Mơ hình điều khiển vị trí động DC J = 0.01 (moment quán tính rotor) b = 0.1 (hệ số giảm chấn hệ thống khí) K = Kt = Ke = 0.01 (hằng số sức điện động) R = 10 (điện trở dây quấn) L = 0.5 (hệ số tự cảm) V: ngõ vào (điện áp đặt cuộn dây động cơ) : ngõ (vị trí trục quay) i: dịng điện chạy cuộn dây 41 MatLab R2013b Cài đặt Các vấn đề Mô Simulink Mô mã lệnh 42 21 23/09/2016 Từ cửa sổ lệnh, gõ edit f = [1 1]; i = 1; while(f(i)+f(i+1))

Ngày đăng: 24/10/2020, 08:21

Xem thêm:

TỪ KHÓA LIÊN QUAN