MATLAB dasturiy tizimida
:
sm
A
10
=
,
cek
rad
/
4
=
,
125
.
0
=
,
6
0
=
qiymatlari
uchun so‘nuvchi tebranma harakat tenglamasi
sm
t
e
x
t
)
6
4
sin(
10
02
.
0
+
=
−
ko‘rinishga
keladi. Tezlikning vaqtga bog‘lanish tenglamasini
dt
dx
=
, tezlanishning vaqtga
bog‘lanish tenglamasini esa
2
2
dt
x
d
dt
d
a
=
=
differensial tenglamani yechish orqali
amalga oshiriladi. Siljish masofasi, tezlik, tezlanishlarning vaqtga bog‘liqlik
grafigini chiziladi.
x=sym('10*exp(-
0.125*t)*sin(pi/4*t+pi/6)')
x =(10*sin(pi/6 +
(pi*t)/4))/exp(0.125*t)
v=diff(x,'t')
v =(5*pi*cos(pi/6 +
(pi*t)/4))/(2*exp(0.125*t)) -
(1.25*sin(pi/6 +
(pi*t)/4))/exp(0.125*t)
v=sym('(5*pi*cos(pi/6 +
(pi*t)/4))/(2*exp(0.125*t)) -
(1.25*sin(pi/6 +
(pi*t)/4))/exp(0.125*t)')
v =(5*pi*cos(pi/6 +
(pi*t)/4))/(2*exp(0.125*t)) -
(1.25*sin(pi/6 +
(pi*t)/4))/exp(0.125*t)
a=diff(v,'t')
a =(0.15625*sin(pi/6 +
(pi*t)/4))/exp(0.125*t) -
(0.625*pi*cos(pi/6 +
(pi*t)/4))/exp(0.125*t) -
(5*pi^2*sin(pi/6 +
(pi*t)/4))/(8*exp(0.125*t))
a=sym('(0.15625*sin(pi/6
+ (pi*t)/4))/exp(0.125*t) -
(0.625*pi*cos(pi/6 +
(pi*t)/4))/exp(0.125*t) -
(5*pi^2*sin(pi/6
+
(pi*t)/4))/(8*exp(0.125*t))')
a=(0.15625*sin(pi/6 +
(pi*t)/4))/exp(0.125*t) -
(0.625*pi*cos(pi/6 +
(pi*t)/4))/exp(0.125*t) -
(5*pi^2*sin(pi/6 +
(pi*t)/4))/(8*exp(0.125*t))
ezplot(x,[0,20])
ezplot(v,[0,20])
ezplot(a,[0,20])
194
b) Dev-C++ dasturlash tilida:
Dev-C++ dasturida dasturlash amalga
oshirish jarayonida funksiyaning argumentga bog‘lanish tenglamasini kiritishda
qulaylik uchun MATLAB dasturiy tizimida yozilgan dastur tarkibidan nusxa olish
maqsadga muvofiq. Dasturlash jarayonida masshtabni, koordinatalar boshini va
ketma-ketlik koeffitsiyenti
k
ni to‘g‘ri tanlash lozim. Shuni ta’kidlash joizki,
MATLAB dasturiy tizimida matematik amallarni bajarish, masala yechimini
topish, grafiklarni chizish, so‘ngra Dev
-C++ (4.9.9.2) dasturlash tilida avval grafik
rejimga o‘tish va dasturlashni amalga oshirish kerak bo’ladi. Kompilyatsiya
jarayonini amalga oshirganimizdan so’ng grafik chizish Dev
-C++ da Console
oynasida qora chiziqlar orqali amalga oshiriladi.
#include
#include
#include
#include
using namespace std;
int main()
{
initwindow(600,400);
setbkcolor(WHITE);
clearviewport();
setcolor(BLACK);
line(0,200,getmaxx(),2
00);
line(300,0,300,getmax
y());
double
x,y,i,pi=3.14,k=0.1;
for(int i=-
250;i<300;i=i+1)
{
x=250+i;
y=200-10*(exp(-
0.125*k*i))*sin(pi/4*k*i+pi/6);
putpixel(x,y,BLACK);
y =200-(2.5*pi*cos(pi/6+pi/4*k*i)*exp(-
0.125*k*i)-(1.25*sin(pi/6+pi/4*k*i))*exp(-
0.125*k*i));
putpixel(x,y,BLACK);
y=200-(0.15625*sin(pi/6+pi/4*k*i)*exp(-
0.125*k*i)-0.625*pi*cos(pi/6+pi/4*k*i)*exp(-
0.125*k*i)-
5*pi*pi*sin(pi/6+pi/4*k*i)/(8*exp(0.125*k*i)));
putpixel(x,y,BLACK);
delay(10);
}
getch();
closegraph();
return 0;
}
Fizikaviy jarayonlarni dasturlash tillaridan foydalanib o‘rganish kelajakda
yosh dasturchidan mukammal dasturlarni yaratishida asos bo‘ladi. Fizikadan
amaliy mashg‘ulot jarayonida zamonaviy axborot texnologiyalaridan foydalanish,
0
2
4
6
8
10
12
14
16
18
20
-6
-4
-2
0
2
4
6
8
t (s)
X = (10 sin(
/6 + (
t)/4))/exp(0.125 t)
X
195
xususan MATLAB, MAPLE, MathCAD dasturiy tizimlari hamda Dev-C++,
Java(SE-8)-
eclipse kompyuter dasturlarini samarali grafik rejimda qo‘llanilishi
o‘quvchi amaliy faoliyatini faollashtirishtiradi hamda dastulash tillarini chiqur
o’zlashtirishida amaliy yordam beradi.
Do'stlaringiz bilan baham: |