Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
polyder([4 5 6 7 8 0 ]);
A = [1 1 1 ; 2 2 2 ; 3 3 3 ] ;
B = [1 1 1 ; 2 2 2 ; 3 3 3 ] ;
D = [1 1 1 1 ; 2 2 2 2 ; 3 3 3 3] ;
% COMMENT
numel(A);
size(A);
det(A);
inv(A);
x = 3 ;
y = 4 ;
x+y ;
A*B;
A.*B;
A(3,2);
C = repmat(A, 3, 4);
C([2, 6], :) ;
C([2, 6], [3, 7]);
C([2:4:end], [3, 7]);
2:3:100;
ans; % calls most recent answer
sqrt(136);
163 / ans;
% multiple asignments
a = 2; b = 7; c = a * b ;
% the command who tells you all the variables you have used
% the command whos tells you more about the varibles (their size, Bytes, Class)
initial_velocity = 0;
acceleration = 9.8;
time = 20;
final_velocity = initial_velocity + acceleration * time;
% the format command
pi;
x = 7 + 10/3 + 5 ^ 1.22;
format long; %16 digits after decimal
x = 7 + 10/3 + 5 ^ 1.22;
pi;
format short % the default format 4 places
x = 7 + 10/3 + 5 ^ 1.22;
pi;
%The format bank command rounds numbers to two decimal places
format bank
daily_wage = 177.45;
weekly_wage = daily_wage * 6 ;
format short e % the e in the output is 10
4.678 * 4.9;
% you can also use the format long e
%The format rat command gives the closest rational expression resulting from a calculation
format rat
4.678 * 4.9;
Advertisements
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.
AcceptLearn more