View the step-by-step solution to:

a) Write a MATLAB function which calculates the minimum positive value of the elements of avector, and call it minpos. If there are no positive...

 a) Write a MATLAB function which calculates the minimum positive value of the elements of avector, and call it minpos. If there are no positive values, it should return the empty matrix.Hint (this part only): Think find or logical relations.

b) If the previous part did not work for matrices, modify it so it does. That is, min returns a rowvector of the minimum value in each column of a matrix, and so should minpos.Hint (this part only): max and min ignore NaNs.

Sign up to view the entire interaction

Top Answer

Here is the code with description... View the full answer

minpos_num.m

clc;
clear all;
A = [-23 100 -37; -15 -52 10]; % Random matrix or you can take matrix of your
choice
if find(A>0)
[i,j]=find(A==min(A(A>0)))
% here i defines the row no. and j defines the...

Sign up to view the full answer

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

-

Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question
Ask a homework question - tutors are online