NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

Type the following in a script file and write down the results.
1.
a=[4 -2 -4 7;1 5 -3 2;6 -8 -5 -6;-7 3 0 1]
size(a)
a(2,3) %returns the element of the matrix in row 2 andcolumn 3.
a(15) %returns 15th position element when the matrix iswritten out as a single column.
inv(a)
a(2,1:3) %lists all values in row 2 which are betweencolumns 1 and 3 inclusive
a(2:4,3) %lists all the values in column 3 which arebetween rows 2 to 4 inclusive.
a(2:3,3:4) %lists all the values which lie between rows 2to 3 and columns 3 to 4.
a(3,:) %lists all the elements along row 3
a(:,2) %lists all the elements along column 2
a(:) %lists all the matrix elements as a single column
b=[2 4 -7 -4;5 6 3 -2;1 -8 -5 -3;0 -6 7 -1];
2*a-3*b %add, subtract and multiply matrices
a^3+b^4 %take matrix powers
c = [3 4 5 6; 6 7 8 9]
d = [8 10 44 999; 0 1 34 55]
c.*d %element to element multiplication
c.^2
d.*d
det(a)
adjoint(a)
inv(a) %inversion is performed using the inv function
a' %transpose is obtained by using the apostrophe
flipud(a) %flip a matrix up/down
fliplr(a) %flip a matrix left/right
2. Realize one dimensional array of real and complex
numbers
a = [1 2 42 50] %row vector
size(a)
c = [1:5:50]
b = [1 2 4 50]' %column vector
size(b)
% Realize one dimensional array of complex numbers
d = [3+5i 7+10i 2-50i]
size(d)
e = [3+5i 7+10i 2-50i].' %compute its nonconjugate transpose
size(e)
f = conj(e)
3. stem and continous plots of real arrays
a = [ 9 8 7 6 5]; % row vector
t = [1 2 3 4 5];
plot(t,a); %continous plot
figure
plot(t,a,'ro')
figure
stem(t,a) %discrete plot
figure
stem(t,a,'b*')
b = [ 5 8 7 6 5]'; % column vector
t = [1 2 3 4 5];
figure
plot(t,b);
figure
plot(t,b,'r+')
figure
stem(t,b)
figure
stem(t,b,'b*')
4. Realization of two dimensional arrays and matrices and
their visualizations
a = rand(100);
imshow(a)
imwrite(a,'myimage1.jpg')
imfinfo('myimage1.jpg')
r = randi([0 50],1000,1000)
imshow(r)
imwrite(r,'myimage2.jpg')
imfinfo('myimage2.jpg')
5. Inverse of a square matrix and the solution of the
matrix equation
a = [1 2 3;4 5 6;7 8 9];
disp('determinant of matrix is');
disp(det(a))
disp('inverse of matrix is');
disp(inv(a))
b = [1 2;1 2]
disp('inverse of matrix is');
inv(b)
a = [1 3 -4; 2 -5 0; -2 -6 8];
b = [0 0 0]'
[x r] = linsolve(a,b)
a = [1 3 -4; 2 -5 8; -3 -6 7];
b = [0 0 0]'
[x r] = linsolve(a,b)
a = [1 2 3; 1 3 4; 2 2 3];
b = [6 8 12]'
[x r] = linsolve(a,b)
a = [1 2 3; 1 3 4; 2 6 8];
b = [6 8 12]'


[x r] = linsolve(a,b)
a = [1 2 3; 1 3 4];
b = [6 8 ]'
[x r] = linsolve(a,b)
6. Computation of the rank ,eigen values of matrix and its
singular value decomposition
a = [2 1 1;1 3 2;3 1 4]
rank(a)
[V D] = eig(a)
[U S V ] = svd(a)
a = [2 -1;-3 2;5 4]
[U S V ] = svd(a)


     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.