AYUSH MISHRA
Followers: 0 Following: 0
Feeds
답변 있음
Write a function called max_sum that takes v, a row vector of numbers, and n, a positive integer as inputs. The function needs to find the n consecutive elements of v whose sum is the largest possible.
function [summa, index] = max_sum(v,n) if n > length(v) summa = 0; ...
Write a function called max_sum that takes v, a row vector of numbers, and n, a positive integer as inputs. The function needs to find the n consecutive elements of v whose sum is the largest possible.
function [summa, index] = max_sum(v,n) if n > length(v) summa = 0; ...
4년 초과 전 | 0
답변 있음
Write a function called halfsum that takes as input an at most two-dimensional array A and computes the sum of the elements of A that are in the lower right triangular part of A
function summa=halfsum(A) [m,n]=size(A); summa=0; for i =1:m fprintf('active row :%d \n',i); fo...
Write a function called halfsum that takes as input an at most two-dimensional array A and computes the sum of the elements of A that are in the lower right triangular part of A
function summa=halfsum(A) [m,n]=size(A); summa=0; for i =1:m fprintf('active row :%d \n',i); fo...
4년 초과 전 | 0
답변 있음
Write a function called under_age that takes two positive integer scalar arguments: age that represents someone's age, and limit that represents an age limit. The function returns true if the person is younger than the age limit. If the second arg
function too_young =under_age(age,limit) if nargin <2 limit=21; end if age<limit too_young=true; else too_you...
Write a function called under_age that takes two positive integer scalar arguments: age that represents someone's age, and limit that represents an age limit. The function returns true if the person is younger than the age limit. If the second arg
function too_young =under_age(age,limit) if nargin <2 limit=21; end if age<limit too_young=true; else too_you...
4년 초과 전 | 0
답변 있음
Write a function called picker that takes three input arguments called condition, in1 and in2 in this order. The argument condition is a logical. If it is true, the function assigns the value of in1 to the output argument out, otherwise, it assigns
function out=picker(condition,in1,in2) if condition==true out=in1; else out=in2; end SOLUTION : picker(tru...
Write a function called picker that takes three input arguments called condition, in1 and in2 in this order. The argument condition is a logical. If it is true, the function assigns the value of in1 to the output argument out, otherwise, it assigns
function out=picker(condition,in1,in2) if condition==true out=in1; else out=in2; end SOLUTION : picker(tru...
4년 초과 전 | 0
답변 있음
Area of a triangle
function area=tri_area(b,h,n) area=0.5*b*h*n; end %Here b=base of triangle , h=height of triangle , n=number of triangl...
Area of a triangle
function area=tri_area(b,h,n) area=0.5*b*h*n; end %Here b=base of triangle , h=height of triangle , n=number of triangl...
4년 초과 전 | 0
답변 있음
Write a function called minimax that takes M, a matrix input argument and returns mmr, a row vector containing the absolute values of the difference between the maximum and minimum valued elements in each row. As a second output argument called mmm,
function [mmr,mmm]=minimax(M) mmr=max(M')-min(M'); mmm=max(max(M'))-min(min(M')); end % here M' is use because when ...
Write a function called minimax that takes M, a matrix input argument and returns mmr, a row vector containing the absolute values of the difference between the maximum and minimum valued elements in each row. As a second output argument called mmm,
function [mmr,mmm]=minimax(M) mmr=max(M')-min(M'); mmm=max(max(M'))-min(min(M')); end % here M' is use because when ...
4년 초과 전 | 0
답변 있음
Calculate taxi fare by giving multiple inputs and single output
function fare= taxi_fare(d,t) d=ceil(d); %d=total distance cover by taxi t=ceil(t); %t=total time taken to complete...
Calculate taxi fare by giving multiple inputs and single output
function fare= taxi_fare(d,t) d=ceil(d); %d=total distance cover by taxi t=ceil(t); %t=total time taken to complete...
4년 초과 전 | 1