You are on page 1of 2

Used basically for visualizations, for plottong the graphs.

Command Window similiar to Command Prompt.


New Script or Cntrl+N, Play to run the code.
"clc" to clear the screen.
"clear all" to clear all the variables.
"size(a)" to know the matrix.
"close all" to clode all the windows.
----------------------------------------------------------------------------------To create a 1x5 matrix b=[1 2 3 4 5]
To create a 5x1 matrix c=[3; 4; 5; 2; 1;]
(instead of ";" or "enter")
To create 3x2 matrix d=[1 2 3; 4 5 6]
Accessing the element d(2,1)
Accessing all the columns/rows d(1,:) or d(:,1)
----------------------------------------------------------------------------------Multiplication
Inverse
Matrix Multiplication
Determinant

:
:
:
:

e=a*3
inv(a)
f=a*b
det(a)

----------------------------------------------------------------------------------Define the variables.


"x=0:1:80;" Syntax means starting from 0 to 80 with gap of 1.
"plot(x,y);grid;" grid would give us an additional grid.
----------------------------------------------------------------------------------Logic for the "for loop"
for variable start number : end number
end
----------------------------------------------------------------------------------F5 for run.
plot(x,y,'r');grid; for different color combinations.
'k' black
plot(x,y,'or') for dotted

plot(x1,y1,'r',x2,y2,'b')for two different colored lines.


----------------------------------------------------------------------------------For simple integration :Y(i) = Y(i-1) + (df/dt)*dt

----------------------------------------------------------------------------------importdata('output.text');clc;

You might also like