Rustam Usmanov



Download 0,56 Mb.
Pdf ko'rish
bet3/4
Sana10.06.2022
Hajmi0,56 Mb.
#650203
1   2   3   4
Bog'liq
Rustam Usmanov (1)

Experiment No: 4
A supermarket conveyor belt holds an array of groceries. The price of each product (in
pounds) is [ 0.6 1.2 0.5 1.3 ] ; while the numbers of each product are [ 3 2 1 5 ]. Use
MATLAB to calculate the total bill.
Code
clc;
price=[0.6];
number=[3 2 1 5];
cost=price.*number'; % or cost=sum(price.*number);
disp(cost);
Output:
1.8000 1.2000 0.6000 3.0000


Experiment No: 5
The sortrows(X) function will sort a vector or matrix X into increasing row order. Use this
function to sort a list of names into alphabetical order.
Code
clc;
fable=['once ';'upon ';'a ';'time ';'there';'lived';'three';'bears'];
sorted=sortrows(fable);
disp(sorted);
Output:_a_bears_lived_once_there_three_time_upon__Experiment_No:_6'>Output:
a bears lived once there three time upon


Experiment No: 6
The “identity” matrix is a square matrix that has ones on the diagonal and zeros
elsewhere. You can generate one with the eye() function in MATLAB. Use MATLAB to
find a matrix B, such that when multiplied by matrix A=[ 1 2; -1 0 ] the identity matrix I=[
1 0; 0 1 ] is generated. That is A*B=I.
Code
clc;
A=[ 2 1; -1 0];
I=eye(2);
B=I/A;
disp(B);
Output:
0 -1
1 2


Experiment No: 7
Draw a graph that joins the points (0,1), (4,3), (2,0) and (5,-2).
code:
x=[0,4,2,5]
y=[1,3,0,-2]
plot(x,y)
Output:


Experiment No: 8
Draw a target made up of three circular rings of radius 1, 2 and 3. The formula for the
co-ordinates of a circle are:
x = r.cos(è) • 0 < è < 2ð
y = r.sin(è) • r > 0
code:
ex32.m
angle=0:0.01:2*pi;
x1=1*cos(angle);
y1=1*sin(angle);
x2=2*cos(angle);
y2=2*sin(angle);
x3=3*cos(angle);
y3=3*sin(angle);
plot(x1,y1,'-',x2,y2,'-',x3,y3,'-');
axis('equal');

Download 0,56 Mb.

Do'stlaringiz bilan baham:
1   2   3   4




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

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish