Guruh talabasi Ismoilov Temurbek 1-laboratoriya ishi. Matlab tizimida interpolyatsiya va approksimatsiya masalalarini yechish


Download 150.36 Kb.
Sana08.02.2023
Hajmi150.36 Kb.
#1176857
Bog'liq
1-lab Matlab Temurbek


211-19 guruh talabasi Ismoilov Temurbek
1-laboratoriya ishi. Matlab tizimida interpolyatsiya va approksimatsiya masalalarini yechish
Ishdan maqsad: Matlab tizimida arifmetik ifodalar qiymatlarini hisoblash, o’zlashtirish operatorlaridan foydalanish, kompleks sonlar bilan ishlash ko’nikmalarini hosil qilish.

Ko’phadning matlabda berilishi:

P3=[6,-4,-2,4]

P3 =

6 -4 -2 4



P1=[4,-2,1] vа P2=[8 2 -6 1] ko’phadlarni Matlabdа ko’paytirish.

1. m>n, ;
.

2. m
ko’phad ildizlarini topamiz.
P2=[1,4,3]

P2 =


1 4 3
C=roots(P2)

C =


-3
-1


ko’phadning x=0.25 dagi qiymatini toping.

P=[6,-4,-2,4]

P =

6 -4 -2 4


y=polyval(P,0.25)

y =


3.3438

  1. х ning qiymatlari matrisa shaklida berilgan bo‘lsin:

P=[4 2 6 3]; X=[100; 010; 001]
P=[4 2 6 3]

P =


4 2 6 3
X=[100; 010; 001]

X =


100
10
1
Y=polyval(P,X)

Y =


4020603
4263
15



  1. funksiyaning bir xil qadamdagi tugun nuqtalardagi qiymatlari asosida 5-tartibli ko‘phad bilan approksimasiya qilish.


x=pi/5:pi/5:4*pi;y=x/2;
p=polyfit(x,y,5); fa=polyval(p,x);
subplot(3,1,1:2),plot(x,y,'-o',x,fa,':*'),grid,hold on;
error=abs(fa-y);subplot(3,1,3),plot(x,error,'--p')


2. funksiyaning [0.1;4.5] oraliqda har xil qadam bilan 3-tartibli ko‘phad bilan approksimasiyasi.
x=[0.1 0.3 0.5 0.75 0.9 1.1 1.3 1.7...
2 2.4 3 3.1 3.6 4 4.1 4.2 4.3 4.5];
y=x/2;p=polyfit(x,y,3); fa=polyval(p,x);
subplot(3,1,1),plot(x,y,'-o'),grid,title('y=sin(x)/x'),hold on;
subplot(3,1,2),plot(x,fa,':*'),grid,title('polinom'),hold on;
error=abs(fa-y);
subplot(3,1,3),plot(x,error,'--p'),grid,title('Oshibka'),hold on;
stem(x,error)



    1. 3. funksiyaning bir xil qadam bilan kubik ko‘phad va kubik splayn asosida interpolyasiyasi.


x=pi/5:pi/2:(4*pi+pi/2);
y=x/2;
xi=pi/5:pi/16:(4*pi+pi/16);
fi1=interp1(x,y,xi,'cubic');
plot(x,y,'-o',xi,fi1,':*'),grid, hold on
legend('y=sin(x)./x','cubic')
figure
fi2=interp1(x,y,xi,'spline');
plot(x,y,'-o',xi,fi2,':*'),grid, hold on
legend('y=sin(x)./x','spline')

Download 150.36 Kb.

Do'stlaringiz bilan baham:




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling