matlab Flashcards

1
Q

to know the size of a matrix

A

size(the name of the variable)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

to call out a certain number in the matrix

A

variable name(row number,column number)
x(3,1)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

to call out an entire row in a matrix

A

using :
x(3,:) is calling out row 3 , nafs l klam m3a l column

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

dot multiplication between two matrix bytala3 scalar

A

dot(x,y)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

cross product between two vectors

A

cross(x,y)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

the constant e

A

exp(1)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

zero or ONE matrix with diff rows and columns

A

zeros(rows,columns)
ones(rows,columns)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

determinant of a matrix

A

det(A)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

to display a value or a variable

A

disp(A)
disp(‘ i found it ‘ )

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

for loop

A

for i=1:10
ekteb ele anta 3awzo
end

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

to plot
to enter a title
to label x and y axis
sub plot

A

plot(x,y)
title(‘A plot of sin x ‘) 3la sbeel el msaal
xlabel(‘time’) ylabel(‘3afreet’)
subplot(2,1,1)
plot m4 3aref eh
subplot(2,1,2)plot 7aga tanya

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

3adad el steps mabeen value and another value

A

x=linspace(0,100,200)
hy3ed mn 0 l 100 f 200 step

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

to plot 2 graphs 2 xs and 2 ys on the same graph

A

plot(x,y,x,y_2)
plot(x,y,’–‘,x,y_2,’.’)
hyrsem l graph l 2awalany f dashes wel tany f no2at

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

bar chart

A

bar(x)
bar(x,y) hyrsemlak bars :D

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

pie chart

A

pie(x)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

scatter chart used lama l data m4 ordered kwyes

A

scatter(x,y)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

3d plotting of a matrix

A

surf(z)
contour(z)

18
Q

to read wave files ( any file that contains digital sound recorded for example by Audicity )to check the size of the matrix

A

d=wavread(‘ Filename.wav’); or u can use audioread(‘Filename.mp3 or wav ‘ )
size(d)

19
Q

to let matlab say outloud the wave file u recorded

A

[d,fs]=wavread(‘Filename.wav’);sound(d,fs);
NB: d is the variable name, fs is frequency sampling

20
Q

to reverse a sound signal and audiowrite it in a new mp3 file

A

d2=flipud(d);
d3=audiowrite(‘helloworldreversed.mp4’, d2, fs);
[d3,fs]= audioread(‘helloworldreversed.mp4’);
sound(d3,fs)

21
Q

to speed up the sound

A

d4=downsample(d,2);
is like doubling the frequency of a wave..

22
Q

to draw the FFT “ fast fourier transform “ which is aka frequency spectrum .. u can also draw only the real part of the signal ( while ignoring the imaginary part )

A

y=fft(d);
z=real(y);
plot(z)

23
Q

spectogram shows different frequencies with change of time. u need to have a tool box from MATLAB company to use it.

A

spectogram(y2)

24
Q

applying a low pass filter an audio stream
dlp is the low passed audio

A

b=ones(40,1)/4;
[d.fs]=audioread(‘Helloworld.mp3’);
dlp=filter(b, 1, d);
sound(‘dlp’)

25
to read an image in matlabto show an image
A=imread('lena.bmp'); imshow(A)
26
to flip an image upsideto flip an image horizontally..
u=flipud(A); u=fliplr(A);
27
any image has only 3 colour channels . Red , green and blue so to show only the colour blue in a picture u gotta disable red and green which are the first two channels.
B=image; B(:, :, 1)=0; B(:, :, 2)=0; imshow(B) > gonna be blue
28
to blur an image using a Gausian filter
H=fspecial('gaussian', 25, 5); c=conv2(double(A(:, :, 1)), h/1000) ; should go lower than 1000 imshow(c) the real gaussian filter looks like imshow(h/max(max(h))
29
to see everything clearly and sharply with no colours.
E=edge(A(:,:,1)); imshow(E)
30
to generate random numbers
R= randi(10) ; will generate a random number below 10 R= randi(10,3); will generate a random matrix 10 rows, 3 columns
31
to get the mean value of a given data
mean(R)
32
to get the variance of given numbers from the average
var(R)
33
Try displaying more decimal places of the variable x
format long x and to go back u need to type format short x
34
starts at 1, ends at 5, with each element separated by 0.5
z=1:0.5:5
35
starts at 1, ends at 10, and contains 5 elements
b = linspace(1,10,5)
36
Transpose b from a row vector to a column vector
b=b'
37
create a column vector named c that starts at 5, ends at 9, and has elements that are spaced by 2.
c = (5:2:9)'
38
Extract the value in the last row and 3rd column of the variable data
y=data(end,3) or end-1 xD
39
performs element-wise multiplication by multiplying the corresponding elements of two equally sized arrays.
.* z = [3 4] .* [10 20]
40