1 ) : - Create a matrix of 3 by 3 with all ones, then Create matrix of 8 by 1 with all zeros , finally Create a matrix of 5 by 2 with all elements equal to 0.37 : -
Code : -
clc
clear all
close all
a = ones ( 3 ) ;
b = zeros ( 8 , 1 )
c = ones ( 5 , 2 )
c = c * 0.37
Output : -
2
) Create vector “s “containing elements of ‘x’ sorted in an ascending order.
Clear x from the workspace. From s create back a vector with the same elements
and in the same order as in x .
Code : -
clc
clear all
x = [ 2 3 7 1 9 0 ];
s = sort( x ) % ascending order
s = sort(x , 'descend'
) % descending order
[s i] = sort(x) % i
represents indexes
Output
: -
3
) Given the same matrix m = [ 1 2 3 ; 2 1 5 ; 4 6 4 ; 2 3 2 ] , create matrix n
with rows sorted in a descending order of elements in the second column .
Code : -
clc
clear all
close all
m = [ 1 2 3 ; 2 1 5 ; 4
6 4 ; 2 3 2 ]
n = sortrows ( m , 2 , ('descend') ) %it
will sort all row according to their 2nd digit
Output
: -
******************************************
Keywords :-
Ascending order in matlab
,
Ascending and descending
order in matlab ,
Matlab programming ,
ultrajobz ,
Ascending order in matlab
in hindi ,
Ascending order number in
matlab
Ascending order in matrix
matlab
Set Ascending order column
in matlab
Ascending order matlab
table
Ascending order matlab
example
Ascending order row in
matlab
descending order in
matlab ,
matlab programming , ultrajobz ,
descending order in
matlab kya hota h ,
descending order in
matlab example ,
descending order command
matlab ,
how to use descending order
in matlab ,
plot in descending order
in matlab ,
sort rows in descending order
in matlab ,
descending order in
matlab e.g ,
descending order in matlab exercise ,
0 Comments