4. y=x^6*sin(x) funksiyaning integralini hisoblang?
s=(s+s1)/2;
break;
else
s1=s;
end;
end
disp(s);
end
NATIJA:
a=4
b=6
-2.6154e+04
5. y= sinx+cos2*x funksiyaning integralini hisoblang?
function m5 ()
a=input('a=');
b=input('b=');
e=0.00001;
n=1000;
s1=0;
while 1
n=n+1000;
h=(b-a)/n;
s=0;
f=@(x)sinx+cos2*x;
for i=a:h:b-h
s=s+(f(i)+f(i+h))/2*h;
end
if(abs(s-s1)
s=(s+s1)/2;
break;
else
s1=s;
end;
end
disp(s);
end
NATIJA:
a=5
b=9
1.0913
6. y= x^3+5*x-8 funksiyaning integralini hisoblang?
function m6 ()
a=input('a=');
b=input('b=');
e=0.00001;
n=1000;
s1=0;
while 1
n=n+1000;
h=(b-a)/n;
s=0;
f=@(x) x^3+5*x-8;
for i=a:h:b-h
s=s+(f(i)+f(i+h))/2*h;
end
if(abs(s-s1)
s=(s+s1)/2;
break;
else
s1=s;
end;
end
disp(s);
end
NATIJA:
a=4
b=6
294.0000
7. y=1/cosx funksiyaning integralini hisoblang?
function m7 ()
a=input('a=');
b=input('b=');
e=0.00001;
n=1000;
s1=0;
while 1
n=n+1000;
h=(b-a)/n;
s=0;
f=@(x)1/cosx;
for i=a:h:b-h
s=s+(f(i)+f(i+h))/2*h;
end
if(abs(s-s1)
s=(s+s1)/2;
break;
else
s1=s;
end;
end
disp(s);
end
8. y=x*sin(2*x) funksiyaning integralini hisoblang?
function m8 ()
a=input('a=');
b=input('b=');
e=0.00001;
n=1000;
s1=0;
while 1
n=n+1000;
h=(b-a)/n;
s=0;
f=@(x)x*sin(2*x);
for i=a:h:b-h
s=s+(f(i)+f(i+h))/2*h;
end
if(abs(s-s1)
s=(s+s1)/2;
break;
else
s1=s;
end;
end
disp(s);
end
NATIJA:
a=6
b=9
-0.4935
9. y=x*sin(x)/cos(x) funksiyaning integralini hisoblang?
function m9 ()
a=input('a=');
b=input('b=');
e=0.00001;
n=1000;
s1=0;
while 1
n=n+1000;
h=(b-a)/n;
s=0;
f=@(x) x*sin(x)/cos(x);
for i=a:h:b-h
s=s+(f(i)+f(i+h))/2*h;
end
if(abs(s-s1)
s=(s+s1)/2;
break;
else
s1=s;
end;
end
disp(s);
end
10. y=1/(sin(x)+cos(x)) funksiyaning integralini hisoblang?
function m10 ()
a=input('a=');
b=input('b=');
e=0.00001;
n=1000;
s1=0;
while 1
n=n+1000;
h=(b-a)/n;
s=0;
f=@(x) 1/(sin(x)+cos(x));
for i=a:h:b-h
s=s+(f(i)+f(i+h))/2*h;
end
if(abs(s-s1)
s=(s+s1)/2;
break;
else
s1=s;
end;
end
disp(s);
end
NATIJA:
a=5
b=6
0.0030
11-Mavzu: Matlab dasturida oddiy differensial tenglamalar.
Nazariy qism:
Ko’plab tizimlar va qurilmalarning dinamikasini tahlil qilish, tebranishlar nazariyasining masalalarini yechish va boshqalar oddiy differensial tenglamalar sistemasini (ODS) yechishga asoslangan. Odatda ular Koshi shaklidagi birinchi tartibli differensial tenglamalar sistemasi tarzida ko’rsatiladi.
ODS uchun chegaraviy shartlar ham ko’rsatiladi: y(t0 tend, p)=b, bu yerda t0, tend – intervalning boshlang’ich va so’ngi nuqtalari.
Boshlang’ich va so’ngi shartlar b vector yordamida beriladi, t parameter albatta vaqt bo’lishi shart emas. ODT larni yechish uchun Matlabda turli xil usullar mavjud. Ularni amalga oshirish ODT yechkichlari deb ataladi. Keyinchalik matnda keltiriladigan umumlashtirilgan solver (yechkich) nomi, ODTni yechimini quyidagi sonli usullaridan birini anglatadi. Ode45, ode23,ode113, ode15s, ode23s, ode23t, ode23tb, bvp4c yoki pdepe. Differensial tenglamalarning qattiq sistemalarini yechish uchun faqat maxsus ode15s, ode23s, ode23d, ode23tb yechkichlardan foydalanish tavsiya etiladi. Differensial tenglamalarni yechish funksiyalarda quyidagi belgilash va qoidalar qabul qilingan: Optios-odeset funsiyasi hosil qiladigan argument(ya’na bir funksiya – odeget yoki bvpget faqat bvp4c uchun ) – sukut bo’yicha yoki odset/bvpset funksiyalari tomonidan o’rnatilgan parametrlarni chiqarish. Functions ode45 Solve nonstiff differential equations; medium order method
ode15s Solve stiff differential equations and DAEs; variable order method
ode23 Solve nonstiff differential equations; low order method
ode113 Solve nonstiff differential equations; variable order method
ode23t Solve moderately stiff ODEs and DAEs; trapezoidal rule
ode23tb Solve stiff differential equations; low order method
ode23s Solve stiff differential equations; low order method
ode15i Solve fully implicit differential equations, variable order method
decic Compute consistent initial conditions for ode15i
Amaliy qism:
1-misol.
2-misol.
3-misol.
4-misol.
5-misol.
6-misol.
7-misol.
8-misol.
9-misol.
10-misol.
Do'stlaringiz bilan baham: