need solution of exercice

10 views (last 30 days)
KHAIF HICHEM
KHAIF HICHEM on 8 Dec 2018
Edited: DGM on 1 Jan 2024
  10 Comments
KHAIF HICHEM
KHAIF HICHEM on 9 Dec 2018
Edited: madhan ravi on 9 Dec 2018
and in the second exercise i have trying this
function [ vmin ] = mini(vect)
%MINI retourne le minimum d’un vecteur
n = numel(vect); if n == 0, vmin = []; else vmin = vect(1);
for k = 2:n
if vect(k) < vmin, vmin = vect(k);
end
end
end
function [ vmax ] = maxi(vect)
%MAXI retourne le maxiimum d’un vecteur
n = numel(vect);
if n == 0, vmax = []; else vmax = vect(1);
for k = 2:n
if vect(k) > vmax, vmax = vect(k);
end
end
end
but the same problem can't resolve
Walter Roberson
Walter Roberson on 10 Dec 2018
what problem are you observing ?

Sign in to comment.

Answers (1)

Moussa Attati
Moussa Attati on 21 Oct 2022
Edited: DGM on 1 Jan 2024
function y = ProductFun(a,b)
m = size(a,1) ; % Column
n = size(b,2) ; % Rows
if size(a,2)==size(b,1)
y = zeros(n,m);
for i = 1 : m
for j = 1 : n
y(i,j)= a(i,:)*b(:,j) ;
end
end
else
disp(' The matrice do not have the same size ')
end
end
  1 Comment
Moussa Attati
Moussa Attati on 21 Oct 2022
Edited: DGM on 1 Jan 2024
function y = SumFun(a,b)
k = size(a,1) ; % Line
j = size(a,2) ; % Column
if size(a) == size(b)
y = zeros(k,j) ;
for i = 1 : k
for u = 1 : j
y(i,u) = a(i,u)*b(i,u) ;
end
end
else
disp(' The matrice do not have the same size ')
end
end

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!