Taif Ahmed BIpul
Followers: 0 Following: 0
Feeds
已回答
[Assignment]Write a function called saddle that finds saddle points in the input matrix M.
function indices=saddle2(M) k=0; indices1=zeros(k); indices2=zeros(k); rowIndices=zeros(k); colIndices=zeros(k); for i=1:s...
[Assignment]Write a function called saddle that finds saddle points in the input matrix M.
function indices=saddle2(M) k=0; indices1=zeros(k); indices2=zeros(k); rowIndices=zeros(k); colIndices=zeros(k); for i=1:s...
4 years 前 | 0
已回答
Write a function called get_distance that accepts two character vector inputs representing the names of two cities. The function returns the distance between them as an output argument called distance. For example, the call get_distance('Seattle, WA'
function distance=get_distance(A,B) [~,~,All]=xlsread('Distances.xlsx'); p=strcmp(All,A); q=strcmp(All,B); r=sum(p(:)); s=s...
Write a function called get_distance that accepts two character vector inputs representing the names of two cities. The function returns the distance between them as an output argument called distance. For example, the call get_distance('Seattle, WA'
function distance=get_distance(A,B) [~,~,All]=xlsread('Distances.xlsx'); p=strcmp(All,A); q=strcmp(All,B); r=sum(p(:)); s=s...
4 years 前 | 1
已回答
I get an error, what's wrong? on Sparse matrix logic and answer
function matrix=sparse2matrix(cellvec) m=ones(cellvec{1}(1),cellvec{1}(2)); m=m.*cellvec{2}; for i=3:length(cellvec) m(cellv...
I get an error, what's wrong? on Sparse matrix logic and answer
function matrix=sparse2matrix(cellvec) m=ones(cellvec{1}(1),cellvec{1}(2)); m=m.*cellvec{2}; for i=3:length(cellvec) m(cellv...
4 years 前 | 0
已回答
caesar cyphor encryption problem .
function coded=caesar(v,n) x=double(v)+n; q=x(x<32); p=x(x>126); while q<32; x(x<32)=x(x<32)+95; q=x(x<32); end ...
caesar cyphor encryption problem .
function coded=caesar(v,n) x=double(v)+n; q=x(x<32); p=x(x>126); while q<32; x(x<32)=x(x<32)+95; q=x(x<32); end ...
4 years 前 | 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 size(v,2)<n summa=0; index=-1; return end p=size(v,2)-(n-1); k=1; A=...
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 size(v,2)<n summa=0; index=-1; return end p=size(v,2)-(n-1); k=1; A=...
4 years 前 | 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); summ=0; for i=1:m for ii=i:n summ=summ+A(i,ii); end end summa=s...
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); summ=0; for i=1:m for ii=i:n summ=summ+A(i,ii); end end summa=s...
4 years 前 | 0