Matlab Plynomial Fitting
Matlab Plynomial Fitting
Matlab Plynomial Fitting
8.1 Polynomials
ﯾﺘﻢ اﻟﺘﻌﺎﻣﻞ ﻣﻊ ﻣﺘﻌﺪد اﻟﺤﺪود ﻓﻲ MATLABﻣﻦ ﺧﻼل ﺗﻮاﺑﻊ ﺧﺎﺻﺔ أﻋﺪت ﻟﺤﻞ ﻣﺘﻌﺪد اﻟﺤﺪود ﺿﻤﻦ ھﺬا
اﻟﺒﺮﻧﺎﻣﺞ .ﺣﯿﺚ ﯾﺘﻢ ﺗﺤﻮﯾﻞ ﻣﺘﻌﺪد اﻟﺤﺪود إﻟﻰ ﻣﺘﺠﮫ ﺳﻄﺮي وﺗﻤﺜﻞ اﻷﻋﺪاد ﺿﻤﻦ ھﺬا اﻟﻨﺴﻖ ﻣﻌﺎﻣﻼت ﻣﺘﻌﺪد
اﻟﺤﺪود .وﺗﺮﺗﺐ ﺿﻤﻦ اﻟﻨﺴﻖ ﺑﺸﻜﻞ ﺗﻨﺎزﻟﻲ ﯾﻮاﻓﻖ ﻗﻮى اﻟﻤﺘﺤﻮل ﻓﻲ ﻣﺘﻌﺪد اﻟﺤﺪود ﺑﺪءا ً ﻣﻦ اﻟﻘﻮة ) (nوﺣﺘﻰ
اﻟﻘﻮة ) (0ﺑﻤﺎ ﻓﻲ ذﻟﻚ اﻟﻤﻌﺎﻣﻼت اﻟﻤﻌﺪوﻣﺔ ﻟﻠﻤﺘﺤﻮل ﺣﯿﺚ ) (nأﻋﻠﻰ رﺗﺒﺔ ﻟﻠﻤﺘﺤﻮل ﻓﻲ ﻣﺘﻌﺪد اﻟﺤﺪود وذﻟﻚ
ﻟﻠﺘﻮاﻓﻖ ﻣﻊ اﻷﺳﻠﻮب اﻟﺬي ﯾﺘﻌﺎﻣﻞ ﻣﻌﮫ ﺑﺮﻧﺎﻣﺞ MATLABﻓﻲ ﺣﻞ ﻣﺘﻌﺪد اﻟﺤﺪود ﻓﻤﺜﻼ ﻟﺪﯾﻨﺎ اﻟﺪاﻟﺔ اﻟﺘﺎﻟﯿﺔ:
;f(t)= 7t^4 +6t^3+3t^2+t+5
ﯾﺘﻢ ﺗﻤﺜﯿﻞ ﻣﺘﻌﺪد اﻟﺤﺪود ھﺬا ﺑﺎﻟﻤﺼﻔﻮﻓﺔ:
A= [7 6 3 1 ]5
ﺣﯿﺚ ﺗﻤﺜﻞ pاﻟﻤﺘﺠﮫ أو اﻟﻤﺼﻔﻮﻓﺔ اﻟﻤﻤﺜﻠﺔ ﻟﻤﺘﻌﺪد اﻟﺤﺪود واﻟﺮﻣﺰ xﯾﻌﺒﺮ ﻋﻦ ﻗﯿﻤﺔ ﻋﺪد أو اﻟﻤﺘﻐﯿﺮ اﻟﻤﺮاد
ﺣﺴﺎب ﻣﺘﻌﺪد اﻟﺤﺪود ﻟﮫ.
ﺣﯿﺚ rﯾﻤﺜﻞ ﻣﺘﺠﮫ ﻋﻤﻮد و pﯾﻤﺜﻞ ﻣﺘﺠﮫ ﺳﻄﺮ ﻟﻤﻌﺎﻣﻼت ﻣﺘﻌﺪد اﻟﺤﺪود.
وﻋﻨﺪﻣﺎ ﯾﻜﻮن ﺟﺬر اﻟﺪاﻟﺔ ﻣﻌﺮوف ﻧﺴﺘﺨﺪم اﻟﺘﺎﺑﻊ polyﻟﺤﺴﺎب ﻣﻌﺎﻣﻼت ﻣﺘﻌﺪد اﻟﺤﺪود واﻟﺼﯿﻐﺔ اﻟﻌﺎﻣﺔ ھﻲ:
b. Multiplication
أﻣﺎ ﻋﻤﻠﯿﺔ اﻟﻀﺮب ﻓﯿﻤﻜﻦ اﻟﻘﯿﺎم ﺑﮭﺎ ﻣﻦ ﺧﻼل اﻻﺳﺘﻌﺎﻧﺔ ﺑﺎﻟﺘﺎﺑﻊ convﻣﺨﺘﺼﺮ ﻛﻠﻤﺔ convolution
وﺑﺎﺳﺘﺨﺪام ھﺬا اﻟﺘﺎﺑﻊ ﯾﺘﻢ اﻟﺤﺼﻮل ﻋﻠﻰ ﺿﺮب ﻣﺘﻌﺪد اﻟﺤﺪود ﺑﺸﺮط أن ﺗﻌﺮف ﻣﺘﻌﺪدات اﻟﺤﺪود ﺑﻤﺼﻔﻮﻓﺎت
ﻣﺘﻮاﻓﻘﺔ وﻣﻌﺒﺮة ﻋﻦ ﻣﻌﺎﻣﻼﺗﮭﺎ واﻟﺼﯿﻐﺔ اﻟﻌﺎﻣﺔ ھﻲ:
c. Division
اﻟﺼﯿﻐﺔ اﻟﻌﺎﻣﺔ ﻟﻌﻤﻠﯿﺔ اﻟﻘﺴﻤﺔ ﺗﺄﺧﺬ اﻟﺸﻜﻞ اﻟﺘﺎﻟﻲ:
;]>> u= [2 9 7 -6
;]>> v= [1 3
;)>> [a b]= deconv(u,v
d. Integration
ﻣﻦ اﻟﻤﻌﺮوف أن اﻟﺘﻜﺎﻣﻞ ھﻮ ﻋﻤﻠﯿﺔ ﻣﻌﺎﻛﺴﺔ ﻟﻼﺷﺘﻘﺎق وﯾﻤﻜﻨﻨﺎ اﻟﺘﺎﺑﻊ polyintاﻟﻤﻮﺟﻮد داﺧﻞ اﻟﻤﻜﺘﺒﺔ
اﻟﺮﯾﺎﺿﯿﺔ ﻓﻲ MATLABﻣﻦ إﯾﺠﺎد ﺗﻜﺎﻣﻞ ﺗﺎﺑﻊ ﻣﻦ ﺧﻼل إدﺧﺎل ﻣﻌﺎﻣﻼت ﻣﺘﻌﺪد اﻟﺤﺪود ﺑﺸﻜﻞ ﻣﺼﻔﻮﻓﺔ.
ﺑﻌﺪ ذﻟﻚ اردﻧﺎ اﺳﺘﻨﺘﺎج اﻟﻨﻤﻮذج اﻟﺮﯾﺎﺿﻲ اﻟﺬي ﯾﺤﻜﻢ ھﺬا اﻟﻨﻈﺎم وﺑﻤﻌﻨﻰ اﺧﺮy وx وﻧﺮﯾﺪ رﺳﻢ اﻟﻌﻼﻗﺔ ﺑﯿﻦ
اﻧﺘﺎج اﻟﺪاﻟﺔ اﻟﺮﯾﺎﺿﯿﺔ اﻟﺘﻲ ﺗﻘﺪم ﻣﻨﺤﻨﻲ ﯾﻤﺮ ﺑﺠﻤﯿﻊ او ﻣﻌﻈﻢ اﻟﻨﻘﺎط اﻟﺘﻲ ﺣﺼﻠﻨﺎ وﺗﻌﺮف ھﺬه اﻟﻌﻤﻠﯿﺔ ب
: واﻟﺼﯿﻐﺔ اﻟﻌﺎﻣﺔ ﻟﮭﺬا اﻻﻣﺮ ھﻲpolyfit وﯾﻤﻜﻦ ﺗﻄﺒﯿﻘﮭﺎ ﺑﺎﺳﺘﺨﺪام اﻻﻣﺮfitting
: طﺮﯾﻘﺔ أﻛﺜﺮ ﻣﻦ ﺗﺎﺑﻊ واﺣﺪ ﺣﯿﺚ ﯾﻤﻜﻦ ﺟﻌﻞ اﻟﺒﺮﻧﺎﻣﺞ ﯾﺤﻮي أﻛﺜﺮ ﻣﻦ ﺗﺎﺑﻊ.2
clear all; close;
% ND: Number of data points
ND= 50;
function
[x,RandData]=DataBuild(NumOfPoints)
[x,f]=DataBuild(ND); x= linspace(0,pi, NumOfPoints);
RandData= sin(x)+0.01*rand(1,length(x));
function g= DataFitting(x,f)
g= DataFitting(x,f) p=polyfit(x,f,4);
g=polyval(p,x);
)'plot(x,g,'r-',x,f,'b--
وﯾﻤﻜﻦ اﺳﺘﺨﺪام اﻻﻣﺮ polyfitﻣﻊ ھﺬه اﻟﺪوال ﻋﻦ طﺮﯾﻖ اﻋﺎدة ﻛﺘﺎﺑﺔ اﻟﺪوال ﺑﺤﯿﺚ ﯾﻤﻜﻦ اﺟﺮاء ﺿﺒﻂ
ﺑﺼﯿﻐﺔ ﻣﺘﻌﺪد ﺣﺪود ﺧﻄﻲ:
y=mx+b
أي ﯾﻤﻜﻦ اﺳﺘﺨﺪام اﻟﺪاﻟﺔ ) polyfit(x,y,1ﻟﺘﺤﺪﯾﺪ اﻟﺜﻮاﺑﺖ اﻷﻓﻀﻞ ﻣﻼﺋﻤﺔ ﺣﯿﺚ ﺗﻜﻮن اﻟﺼﯿﻎ ﺑﺎﻟﺸﻜﻞ:
8.3 Interpolation
اﻻﺳﺘﯿﻔﺎء أو اﻻﺳﺘﻜﻤﺎل ھﻮ ﻋﻤﻠﯿﺔ إﯾﺠﺎد ﻗﯿﻤﺔ yﻋﻨﺪ ﻗﯿﻤﺔ ﻣﻌﻠﻮﻣﺔ xﻟﯿﺴﺖ ﻣﻮﺟﻮدة ﻓﻲ ﺟﺪول اﻟﻨﻘﺎط اﻟﻤﻌﻄﺎة
وﺗﺴﻤﻰ ھﺬه اﻟﻌﻤﻠﯿﺔ ﻗﻀﯿﺔ اﻻﺳﺘﻜﻤﺎل وﯾﺠﺐ اﻟﺘﻔﺮﻗﺔ ﺑﯿﻦ ﻧﻮﻋﯿﻦ ﻣﻦ اﻟﻘﻀﺎﯾﺎ:
اﻟﻘﻀﯿﺔ اﻷوﻟﻰ :أن اﻟﻨﻘﻄﺔ اﻟﻤﻄﻠﻮﺑﺔ داﺧﻞ ﻧﻘﺎط اﻟﺠﺪول وﺑﺎﻟﺘﺎﻟﻲ ﺗﺴﻤﻰ اﻟﻌﻤﻠﯿﺔ ﻓﻲ ھﺬه اﻟﺤﺎﻟﺔ اﺳﺘﻜﻤﺎل داﺧﻠﻲ
.Interior Interpolation
اﻟﻘﻀﯿﺔ اﻟﺜﺎﻧﯿﺔ :أن ﺗﻜﻮن اﻟﻨﻘﻄﺔ اﻟﻤﻄﻠﻮﺑﺔ ﺧﺎرج ﻧﻘﺎط اﻟﺠﺪول وﺑﺎﻟﺘﺎﻟﻲ ﺗﺴﻤﻰ اﻟﻌﻤﻠﯿﺔ ﻓﻲ ھﺬه اﻟﺤﺎﻟﺔ اﺳﺘﻜﻤﺎل
ﺧﺎرﺟﻲ .Exterior Extrapolation
وﻓﻲ اﻻﺳﺘﯿﻔﺎء أﺣﺎدي اﻟﺒﻌﺪ ﯾﻜﻮن ﻟﻜﻞ ﻧﻘﻄﺔ ﻣﺘﻐﯿﺮ واﺣﺪ ﻣﺴﺘﻘﻞ xوﻣﺘﻐﯿﺮ ﻣﻌﺘﻤﺪ واﺣﺪ .yأﻣﺎ ﻓﻲ اﻻﺳﺘﯿﻔﺎء
ﺛﻨﺎﺋﻲ اﻷﺑﻌﺎد ﻓﻠﻜﻞ ﻧﻘﻄﺔ ﻣﺘﻐﯿﺮﯾﻦ ﻣﺴﺘﻘﻠﯿﻦ xو yوﻣﺘﻐﯿﺮ ﻣﻌﺘﻤﺪ واﺣﺪ .z
اﻟﺼﯿﻐﺔ اﻟﻌﺎﻣﺔ
ﯾُﻄﻠﻖ ﻋﻠﻰ أﺑﺴﻂ طﺮﯾﻘﺔ ﻟﻼﺳﺘﯿﻔﺎء اﺳﻢ اﺳﺘﯿﻔﺎء اﻟﺸﺮﯾﺤﺔ اﻟﺨﻄﯿﺔ ،وﻓﻲ ھﺬه اﻟﻄﺮﯾﻘﺔ واﻟﻤﻮﺿﺤﺔ ﻓﻲ اﻟﺸﻜﻞ
أدﻧﺎه ،ﺗﺮﺗﺒﻂ ﻛﻞ ﻧﻘﻄﺘﯿﻦ ﻣﺘﺠﺎورﺗﯿﻦ ﺑﺨﻂ ﻣﺴﺘﻘﯿﻢ ﻣﺘﻌﺪد اﻟﺤﺪود ﻣﻦ اﻟﺪرﺟﺔ اﻷوﻟﻰ.
ﺗﺘﻢ ﻋﻤﻠﯿﺔ اﻻﺳﺘﻜﻤﺎل اﻟﺪاﺧﻠﻲ أﺣﺎدي اﻟﺒﻌﺪ ﻓﻲ MATLABﺑﺎﺳﺘﺨﺪام اﻟﺪاﻟﺔ interp1واﻟﺘﻲ ﺗﺄﺧﺬ اﻟﺸﻜﻞ
اﻟﺘﺎﻟﻲ )ﺻﻔﺤﺔ :(276
ﺣﯿﺚ:
ﯾﺠﺐ أن ﯾﻜﻮن xﻣﺘﺠﮭًﺎ ﻣﻊ ﻋﻨﺎﺻﺮ ﺑﺘﺮﺗﯿﺐ ﺗﺼﺎﻋﺪي أو ﺗﻨﺎزﻟﻲ.
ﯾﻤﻜﻦ أن ﯾﻜﻮن xiﻋﺪدا )اﻻﺳﺘﻜﻤﺎل ﻟﻨﻘﻄﺔ واﺣﺪة( أو ﻣﺘﺠﮫ )اﻻﺳﺘﻜﻤﺎل ﻟﻌﺪد ﻣﻦ اﻟﻨﻘﺎط( و yiھﻮ ﻋﺪد أو ﻣﺘﺠﮫ
ﺑﻘﯿﻢ اﻻﺳﺘﻜﻤﺎل اﻟﻤﻘﺎﺑﻠﺔ.
ﯾﻤﻜﻨﻨﺎ MATLABﻣﻦ اﻟﻘﯿﺎم ﺑﺎﻻﺳﺘﯿﻔﺎء ﺑﺎﺳﺘﺨﺪام واﺣﺪ ﻣﻦ ﻋﺪة طﺮق ﯾﻤﻜﻦ ﺗﺤﺪﯾﺪھﺎ وﺗﺘﻀﻤﻦ ھﺬه اﻟﻄﺮق:
:’nearest’ .1اﻷﻗﺮب ﺗﻘﻮم ﺑﺈرﺟﺎع ﻗﯿﻤﺔ ﻧﻘﻄﺔ اﻟﺒﯿﺎﻧﺎت اﻷﻗﺮب إﻟﻰ اﻟﻨﻘﻄﺔ اﻟﻤﺤﻮﻟﺔ.
:’linear’ .2ﯾﺴﺘﺨﺪم ﺷﺮﯾﺤﺔ اﻻﺳﺘﯿﻔﺎء اﻟﺨﻄﻲ.
:’spline’ .3ﯾﺴﺘﺨﺪم اﻻﺳﺘﯿﻔﺎء اﻟﻤﻜﻌﺐ.
:’pchip’ .4ﺗﺴﺘﺨﺪم اﻻﺳﺘﯿﻔﺎء اﻟﻤﻜﻌﺐ اﻟﮭﺮﻣﻲ وﯾﺴﻤﻰ أﯾﻀﺎ اﻟﻤﻜﻌﺐ.
ﻣﻼﺣﻈﺎت:
.1ﻋﻨﺪ اﺳﺘﺨﺪام اﻟﻄﺮق ’ ’nearestو ’ ،’linearﯾﺠﺐ أن ﺗﻜﻮن ﻗﯿﻤﺔ xiﺿﻤﻦ ﻣﺠﺎل
xوإذا ﺗﻢ اﺳﺘﺨﺪام أﺳﺎﻟﯿﺐ’ ’splineأو ’ ’pchipﯾﻤﻜﻦ أن ﺗﺤﺘﻮي xiﻋﻠﻰ ﻗﯿﻢ ﺧﺎرج ﻧﻄﺎق
xوﺗﻘﻮم اﻟﺪاﻟﺔ interp1ﺑﺈﺟﺮاء ﻋﻤﻠﯿﺔ اﺳﺘﻘﺮاء .Extrapolation
.2ﯾﻤﻜﻦ أن ﺗﻌﻄﻲ طﺮﯾﻘﺔ ’ ’splineأﺧﻄﺎء ﻛﺒﯿﺮة إذا ﻛﺎﻧﺖ ﻧﻘﺎط ﺑﯿﺎﻧﺎت اﻹدﺧﺎل ﻏﯿﺮ ﻣﻨﺘﻈﻤﺔ،
ﺑﺤﯿﺚ ﺗﻜﻮن ﺑﻌﺾ اﻟﻨﻘﺎط أﻗﺮب ﻣﻦ ﺑﻌﻀﮭﺎ اﻟﺒﻌﺾ.
.3ﻋﻠﻤﺎ إن ﻣﻮاﺻﻔﺎت اﻟﻄﺮﯾﻘﺔ اﺧﺘﯿﺎرﯾﺔ وإذا ﻟﻢ ﯾﺘﻢ ﺗﺤﺪﯾﺪ أي طﺮﯾﻘﺔ ،ﻓﯿﻜﻮن اﻹﻋﺪاد اﻻﻓﺘﺮاﺿﻲ ھﻮ
ﺧﻄﻲ.
8.4 Examples of MATLAB Applications
ﻣﺜﺎل رﻗﻢ ) (1ﺻﻔﺤﺔ رﻗﻢ ) (262
For the polynomial: .
(a) Calculate .
(b) Plot the polynomial for
(c) The roots of the polynomial.
(d) the coefficients of the polynomial.
اﻟﺒﺮﻧﺎﻣﺞ:
% a
;]>> p = [1 -12.1 40.59 -17.015 -71.95 35.88
)>> polyval(p,9
ans = 7.2611e+003
% b
;>> x=-1.5:0.1:6.7
;)>> y=polyval(p,x
)>> plot(x,y
% c
;]>> p= [1 -12.1 40.59 -17.015 -71.95 35.88
)>> r=roots(p
r = 6.5000
4.0000
2.3000
-1.2000
0.5000
% d
>> r=6.5 4 2.3 -1.2 0.5];
>> p=poly(r)
p = 1.0000 -12.1000 40.5900 -17.0150 -71.9500 35.8800
(276 ) ( ﺻﻔﺤﺔ رﻗﻢ2) ﻣﺜﺎل رﻗﻢ
The following data points, which are points of the function:
, are given. Use linear, spline, and pchip interpolation
methods to calculate the value of y between the points. Make a figure for each of
the interpolation methods. In the figure show the points, a plot of the function, and
a curve that corresponds to the interpolation method.
x 0 1 2 3 4 5
y 1 -0.6242 -1.4707 3.2406 -0.7366 -6.3717
ﺑﯿﻦ اﻟﻨﻘﺎط ﻟﻠﻘﯿﻢ اﻟﻤﻮﺿﺤﺔ ﻓﻲ اﻟﺠﺪول وارﺳﻢ ﺷﻜﻞ ﺗﻄﺒﯿﻖ طﺮقy ﺑﺎﺳﺘﺨﺪام ﺛﻼﺛﺔ طﺮق ﻟﻼﺳﺘﻜﻤﺎل اﺣﺴﺐ ﻗﯿﻢ
. وﻓﻲ اﻟﺮﺳﻢ اﺷﺮ ﻟﻠﻨﻘﺎط وارﺳﻢ اﻟﺪاﻟﺔ وارﺳﻢ اﺿﺒﻂ ﻣﻨﺤﻨﻲ ﯾﻤﺮ ﺑﺎﻟﻨﻘﺎط.اﻻﺳﺘﻜﻤﺎل اﻟﺜﻼﺛﺔ اﻟﻤﺸﺎر ﻟﮭﺎ
:اﻟﺒﺮﻧﺎﻣﺞ
% إﻧﺸﺎء اﻟﻤﺘﺠﮭﺎت
x=0:1.0:5;
y=[1.0 -0.6242 -1.4707 3.2406 -0.7366 -6.3717];
xi=0:0.1:5;
% ﻣﻦ ﺛﻼﺛﺔ اﻧﻮاع ﻟﻼﺳﺘﻜﻤﺎلy ﺣﺴﺎب ﻧﻘﺎط
yilin=interp1(x,y,xi,'linear');
yispl=interp1(x,y,xi,'spline');
yipch=interp1(x,y,xi,'pchip');
% ﻣﻦ ﺗﻄﺒﯿﻖ اﻟﺪاﻟﺔ اﻟﻤﻌﻄﺎة ﻓﻲ اﻟﺴﺆالy ﺣﺴﺎب
yfun=1.5.^xi.*cos(2*xi);
subplot(1,3,1)
plot(x,y,'o',xi,yfun,xi,yilin,'--');
subplot(1,3,2)
plot(x,y,'o',xi,yfun,xi,yispl,'--');
subplot(1,3,3)
plot(x,y,'o',xi,yfun,xi,yipch,'--');
that weighs 15 lb. The specific weight of aluminum is 0.101 lb/in3. The volume of
the aluminum VAl is calculated from: , where γ is the specific weight.
ﻓﻲ24 ھﻲ، ﻣﺼﻨﻮﻋﺔ ﻣﻦ اﻷﻟﻤﻨﯿﻮم،( ﺑﺪون ﻗﻤﺔ،اﻷﺑﻌﺎد اﻟﺨﺎرﺟﯿﺔ ﻟﺼﻨﺪوق ﻣﺴﺘﻄﯿﻞ )أﺳﻔﻞ وأرﺑﻌﺔ ﺟﻮاﻧﺐ
x اﺷﺘﻖ ﺗﻌﺒﯿﺮ ًا ﯾﺮﺑﻂ وزن اﻟﺼﻨﺪوق وﺳﻤﻚ اﻟﺠﺪار.x ﺳﻤﻚ اﻟﺠﺪار ﻣﻦ اﻟﻘﺎع واﻟﺠﺎﻧﺒﯿﻦ ھﻮ. أﻧﺞ4 ﻓﻲ12
وﺣﺠﻢ.0.101 lb/in3 ﻋﻠﻤﺎ إن اﻟﻮزن اﻟﻤﺤﺪد ﻟﻸﻟﻤﻨﯿﻮم ھﻮ. ً رطﻼ15 ﻟﻠﺼﻨﺪوق اﻟﺬي ﯾﺰنx وﺣﺪد اﻟﺴﻤﻚ
. ﺗﻤﺜﻞ اﻟﻮزن اﻟﻨﻮﻋﻲγ و اﻷﻟﻤﻨﯿﻮم ﯾﺤﺴﺐ ﻣﻦ اﻟﻌﻼﻗﺔ
:اﻟﺒﺮﻧﺎﻣﺞ
W=15; gamma=0.101;
% ﻧﺤﺴﺐ ﺣﺠﻢ اﻻﻟﻤﻨﯿﻮم
VAlum=W/gamma;
% VAl = 24 . 12 . 4 – (24 – 2x) (12 – 2x) (4 – x)
a=[-2 24]; % 24 – 2x :a ﻣﺘﻌﺪد اﻟﺤﺪود ل
b=[-2 12]; % 12 – 2x :b ﻣﺘﻌﺪد اﻟﺤﺪود ل
c=[-1 4]; %4–x :c ﻣﺘﻌﺪد اﻟﺤﺪود ل
% ﻧﺠﺮي ﻋﻤﻠﯿﺔ اﻟﻀﺮب ﻟﻤﺘﻌﺪدات اﻟﺤﺪود اﻟﺜﻼﺛﺔ اﻋﻼه
Vin=conv(c, conv(a,b));
% Vin ( اﻟﻰVAl – 24*12*4) :ﻧﻀﯿﻒ اﻟﻤﻘﺪار
polyeq=[0 0 0 (VAlum-24*12*4)]+Vin
% ﻧﺤﺪد ﺟﺬر ﻣﺘﻌﺪد اﻟﺤﺪود
x=roots(polyeq)
:اﻟﻨﺎﺗﺞ
% – 4x3 + 88x2 – 576x + 148.515 :ﻣﺘﻌﺪد اﻟﺤﺪود ھﻮ
polyeq =
-4.0000 88.0000 -576.0000 148.5149
% واﻟﺬي ﯾﻤﺜﻞ ﺳﻤﻚ ﺟﺪار اﻻﻟﻤﻨﯿﻮم0.2687 ﻣﺘﻌﺪد اﻟﺤﺪود ﯾﻤﺘﻠﻚ ﺟﺬر ﺣﻘﯿﻘﻲ واﺣﺪ ھﻮ
x =
10.8656 + 4.4831i
10.8656 - 4.4831i
0.2687
(282) ( ﺻﻔﺤﺔ رﻗﻢ4) ﻣﺜﺎل رﻗﻢ
An aluminum thin-walled sphere is used as a marker buoy. The sphere has a radius
of 60 cm and a wall thickness of 12 mm. The density of aluminum is
kg/m3. The buoy is placed in the ocean, where the density of the water is 1030
kg/m3. According to Archimedes’ law, the weight of
the sphere is given by:
, where
is the volume of the aluminum; and are the
outside and inside radii of the sphere, respectively;
and is the gravitational acceleration.. The weight
of the water that is displaced by the spherical portion that is submerged is given
by: and setting the two
weights equal to each other gives the following equation:
Mustansirayah University, Collage of Science, Physics Department 2020-2021 Page 9
CH-8 Dr. Elham Jasim Mohammad
:اﻟﺒﺮﻧﺎﻣﺞ
% ادﺧﺎل ﻗﯿﻢ اﻟﻘﻄﺎر
rout=0.60; rin=0.588;
% ادﺧﺎل ﻗﯿﻢ ﻛﺜﺎﻓﺔ اﻟﻤﺘﻐﯿﺮات
rhoalum=2690; rhowtr=1030;
% a0 اﯾﺠﺎد اﻟﻤﻌﺎﻣﻞ
a0=4*rout^3-4*rhoalum*(rout^3-rin^3)/rhowtr;
% اﯾﺠﺎد ﻣﻌﺎﻣﻼت ﻣﺘﻌﺪد اﻟﺤﺪود
p = [1 -3*rout 0 a0];
% اﯾﺠﺎد ﺟﺬر ﻣﺘﻌﺪد اﻟﺤﺪود
h = roots(p)
:اﻟﻨﺎﺗﺞ
% 0.9029 ﻣﺘﻌﺪد اﻟﺤﺪود ﯾﻤﺘﻠﻚ ﺛﻼﺛﺔ ﺟﺬور واﻟﺠﺬر اﻟﻤﺴﻤﻮح ﺑﮫ ﻓﯿﺰﯾﺎﺋﯿﺎ ھﻮ
h =
1.4542
0.9029
-0.5570
t (s) 1 2 3 4 5 6 7 8 9 10
V (V) 9.4 7.31 5.15 3.55 2.81 2.04 1.26 0.97 0.74 0.58
وﻣﻦ أﺟﻞ ﺗﺤﺪﯾﺪ اﻟﺴﻌﺔ اﻟﺨﺎﺻﺔ ﺑﮫ.ﻣﻜﺜﻒ ﻛﮭﺮﺑﺎﺋﻲ ﻟﺪﯾﮫ ﺳﻌﺔ ﻣﺠﮭﻮﻟﺔ
B ﻓﻲ اﻟﺒﺪاﯾﺔ ﺗﻢ ﺗﻮﺻﯿﻞ اﻟﻤﻔﺘﺎح ﺑـ.ﺗﻢ ﺗﻮﺻﯿﻠﮫ ﺑﺎﻟﺪاﺋﺮة اﻟﻤﻌﺮوﺿﺔ
وﺗﻢ ﺗﻔﺮﯾﻎ اﻟﻤﻜﺜﻒ ﻋﺒﺮA ﺛﻢ ﺗﻢ ﺗﻮﺻﯿﻞ اﻟﻤﻔﺘﺎح إﻟﻰ.وﺷﺤﻦ اﻟﻤﻜﺜﻒ
1 ﺛﺎﻧﯿﺔ ﺧﻼل ﻓﺘﺮة10 وﺗﻢ ﻗﯿﺎس اﻟﺠﮭﺪ ﻋﺒﺮ اﻟﻤﻜﺜﻒ ﻟﻤﺪة.اﻟﻤﻘﺎوم
ﯾﺘﻢ إﻋﻄﺎء ﺟﮭﺪ اﻟﻤﻜﺜﻒ، وﻋﻨﺪﻣﺎ ﯾﺘﻢ ﺗﻔﺮﯾﻎ ﻣﻜﺜﻒ ﻋﺒﺮ اﻟﻤﻘﺎوم. ﺛﺎﻧﯿﺔ
واﻟﻘﯿﺎﺳﺎت اﻟﻤﺴﺠﻠﺔ ﻣﻌﺮوﺿﺔ ﻓﻲ.ﻛﺪاﻟﺔ ﻟﻠﻮﻗﺖ ﺑﻮاﺳﻄﺔ اﻟﻌﻼﻗﺔ
. ارﺳﻢ اﻟﺠﮭﺪ ﻛﺪاﻟﺔ ﻟﻠﻮﻗﺖ وﺣﺪد ﺳﻌﺔ اﻟﻤﻜﺜﻒ ﻣﻦ ﺧﻼل ﺿﺒﻂ ﻣﻨﺤﻨﻲ أﺳﻲ ﻟﻨﻘﺎط اﻟﺒﯿﺎﻧﺎت.اﻟﺠﺪول أدﻧﺎه
:اﻟﺒﺮﻧﺎﻣﺞ
R=2000;
t=1:10;
v=[9.4 7.31 5.15 3.55 2.81 2.04 1.26 0.97 0.74 0.58];
% polyfit اﺳﺘﺨﺪام داﻟﺔ
p=polyfit(t,log(v),1);
% y= mx +b : ﻓﻲ اﻟﻤﻌﺎدﻟﺔb وm واﻟﺘﻲ ﺗﻘﺎﺑﻞ ﻗﯿﻢV0 وC ﺣﺴﺎب ﻗﯿﻢ
C=-1/(R*p(1))
V0=exp(p(2))
% اﻧﺸﺎء ﻣﺘﺠﮭﺎت ﻟﺮﺳﻢ اﻟﺪاﻟﺔ
tplot=0:0.1:10;
vplot=V0*exp(-tplot./(R*C));
plot(t,v,'o',tplot,vplot)
:اﻟﻨﺎﺗﺞ
C =
0.0016
V0 =
13.2796