?? x_force_inductance_relation.m
字號:
%計算電感系數、電磁力與位移x之間的關系曲線
clc
clear
% x和L的數據
xdata=[0,0.2,0.4,0.6,0.8,1.0,1.2,1.4,1.6,1.8,2.0];
Ldata=[2.8,2.26,1.78,1.52,1.34,1.26,1.20,1.16,1.13,1.11,1.10];
%換算成國際單位制
x=xdata*1.e-2;
L=Ldata*1.e-3;
len=length(x)
xmax=x(len);
%曲線擬合
a=polyfit(x,L,4);
%擬合檢查
for n=1:101
xfit(n)=xmax*(n-1)/100;
Lfit(n)=a(1)*xfit(n)^4+a(2)*xfit(n)^3+a(3)*xfit(n)^2+a(4)*xfit(n)+a(5);
end
%繪圖
plot(xdata,Ldata,'*')
hold
plot(xfit*100,Lfit*1000)
hold
xlabel('x[cm]')
ylabel('L[mH]')
fprintf('\n Paused.Hit any key to plot the force.\n')
pause;
% 電磁力計算與繪圖
%電流數值
I=0.75;
for n=1:101
xfit(n)=0.002+0.016*(n-1)/100;
F(n)=4*a(1)*xfit(n)^3+3*a(2)*xfit(n)^2+2*a(3)*xfit(n)+a(4);
F(n)=(I^2/2)*F(n);
end
plot(xfit*100,F)
xlabel('x[cm]')
ylabel('Force [N]')
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -