Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 12

เรื่อง ระบบจำลองทางคณิ ตศาตร์ดว้ ย Curve Fitting 

วัตุประสงค์ 1. สามารถสร้างระบบจำลองทางคณิ ตศาสตร์ดว้ ย Curve Fitting 


2. สามารถประยุกต์การสร้างระบบจำลองทางคณิ ตศาสตร์ของ Air Motor ด้วย Curve Fitting 
3. สามารถเปรี ยบเทียบผลตอบสนองระหว่างระบบจำลองทางคณิ ตศาสตร์ และ datasheet
วิธีทดลอง 
ประกอบไปด้วย 2 ส่ วนคือ การ scale รู ปภาพของ characteristic ของ air motor ในพิกดั x-y plane และการหา
สมการจากข้อมูลของรู ปภาพ
ส่ วนที่ 1
1. เลือกอุปกรณ์ Air motor model จากผูผ้ ลิตอุปกรณ์

2.  Crop รู ป characteristic อุปกรณ์ Air motor แสดงได้ดงั นี้


3. Save รู ปภาพด้วยนามสกุล PNG วางในเดียวกันกับ directory folder ของ MATLAB
4. หาพิกดั ของกราฟแต่ละพารามิเตอร์จาก code ข้างล่างและใช้ ‘Data Tips’
clear all
close all
img = imread('AirMotor.png'); % Load a sample
image
hold on; % Add to the plot
image([0 3000],[2.7 0],img);
%ค่า 2.7 เป็ นพิกดั สูงสุดของแรงบิดจะถูกเปลี่ยนตามพิกดั ของพารามิเตอร์ตวั ถัดไป
xlim([0 3000]) %กำหนดช่วงของการแสดงรู ปภาพในแนวแกน x
ylim([0 2.7])%กำหนดช่วงของการแสดงรู ปภาพในแนวแกน y

บันทึกผลการหาค่าพิกดั จากรู ปโดยใช้ ‘Data Tips’และ ‘Shift+Click’ได้คือ


พิกดั แรงบิด (Nm)
[ ];
พิกดั ความเร็ วรอบ(rpm)
[ ];
พิกดั ความเร็ วรอบ(rad/s)
[ ]*pi/30;
พิกดั อัตราการไหลของอากาศ(l/s)
[ ];
พิกดั ความเร็ วรอบ(rpm)
[ ];
พิกดั ความเร็ วรอบ(rad/s)
[ ]*pi/30;

5. สร้างตัวแปร ใน workspace เป็ นข้อมูลแบบ array ได้คือ


Matlab command:
ส่ วนที่ 2
6. ใช้ค ำสัง่ “cftool” ใน matlab command ดังแสดงได้ตามรู ปข้างล่างนี้

7. Import data จากตัวแปรที่อยูใ่ น workspace เพื่อเป็ นข้อมูลในตำแหน่งของแกน x และ แกน y


(หมายเลข 1)
8. เลือกวิธีการสร้างสมการในหมายเลข 2

บันทึกผลการสมการ
สมการแรงบิด ณ ความเร็ วรอบใดๆ
สมการอัตราการไหลของอากาศ ณ ความเร็ วรอบใดๆ

เมื่อกำหนดให้ กำลังของ air motor (P-W) คือ แรงบิด(T-Nm)*อัตราเร็ วเชิงมุมของการหมุน(-rad/s)

สมการกำลังของ air motor ณ ความเร็ วรอบใดๆ

Plot กราฟเปรี ยบเทียบกับ datasheet


MATLAB Command คือ
%%%%%%%%%%%%% Air motor model LZB14-L-A029-11%%%%%%%%%%%%%%%%%%%%%%%%
%%
clear all
close all
clc
wr=0:300;
Torq = ;
Pout=Torq.*wr/1000;
fl = ;
fig1=figure(1)
%%Create 3 axes
Ax1=axes;
Ax2=copyobj(Ax1,fig1);
Ax3=copyobj(Ax1,fig1);

%%Set axes colors


AxColors={[1 0 0],[0 0 0],[0 0 1]};

%%Set XLim here


xmax=3200; %set ~20% higher than max xdata
xmin=0;

%%Plot whatever here


axes(Ax1);hold on
l1=ylabel('Torque(Nm)');
xlabel('speed(rpm)')
h1=plot(wr*30/pi,Torq,'Linewidth',2);
axis([0 3000 0 2.7])
set(gca,'YTick',0:0.3:2.7,'fontsize',10,'fontweight','b');
set(h1,'color',AxColors{1})
box off
drawnow

%%Second yaxis
axes(Ax2);hold on
l2=ylabel('Power(kW)')
h2=plot(wr*30/pi, Pout,'Linewidth',2);
axis([0 3000 0 0.18])
set(h2,'color',AxColors{2})
drawnow

%%Third yaxis
axes(Ax3);hold on
l3=ylabel('Air consumption (l/s)')
h3=plot(wr*30/pi,fl,'Linewidth',2);
axis([0 3000 0 9])
set(h3,'color',AxColors{3})
drawnow
%%Fix some visuals
set([Ax1 Ax2 Ax3],'xlim',[xmin xmax])
set([Ax2 Ax3],'XColor','none');
set([Ax1 Ax2 Ax3],'Color','none');
XTicks=Ax1.XTick;
XTicks(XTicks>0.95*xmax)=[];

%%Set YAxis colors


set(Ax1,'YColor',AxColors{1});
set(Ax2,'YColor',AxColors{2});
set(Ax3,'YColor',AxColors{3});

%%Fix XTicks and XRuler


Ax1.XTick=XTicks;
Ax2.YRuler.FirstCrossoverValue = 1*xmax;
Ax3.YRuler.FirstCrossoverValue = 0.95*xmax;

drawnow

YMinAx1=get(Ax1,'YLim');
Ax1.XRuler.Axle.VertexData=single([0 0.9*xmax;YMinAx1(1) YMinAx1(1);0
0]);
drawnow
title('Air motor(LZB14-L-A029-11)')

ให้เปรี ยบเทียบผลของสมการ curve fitting ด้วย matlab และ datasheet ของ


ตัวอย่าง
subplot(2,1,2)
hold on
image([0 3000],[2.7 0],imread(NAME.png'));
%ค่า 2.7 เป็ นพิกดั สูงสุดของแรงบิดจะถูกเปลี่ยนตามพิกดั ของพารามิเตอร์ตวั ถัดไป
xlim([0 3000]) %กำหนดช่วงของการแสดงรู ปภาพในแนวแกน x
ylim([0 2.7])%กำหนดช่วงของการแสดงรู ปภาพในแนวแกน y
set(gca,'YTick',0:0.3:2.7,'fontsize',10,'fontweight','b');
ylabel('Nm')
xlabel('r/min')
wr_am=10:303;
T_am=2.263e-08*wr_am.^3 -5.63e-06*wr_am.^2 -0.008109*wr_am + 2.345;
hold on; % Add to the plot
subplot(2,1,1),plot(wr_am*30/pi,T_am,'r','linewidth',2);
grid on
set(gca,'YTick',0:0.3:2.7,'fontsize',10,'fontweight','b');
set(gca,'xTick',0:500:3000,'fontsize',10,'fontweight','b');
xlim([0 3000]) %กำหนดช่วงของการแสดงรู ปภาพในแนวแกน x
ylim([0 2.7])%กำหนดช่วงของการแสดงรู ปภาพในแนวแกน y
ylabel('Nm')
xlabel('r/min')
title('Torque characteristic of air motor(LZB14-L-A029-11)')

You might also like