联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp

您当前位置:首页 >> Matlab编程Matlab编程

日期:2020-01-29 08:54

Math 9 Homework 3

Winter 2020

Write the following functions files in Matlab, create a zip file containing these files and upload this zip

file to Canvas. To receive full credit, you must use the exact function names given below, and you must

not have extra terms getting printed to the screen. Make sure your file name is the same as your function

name. The name of your zip file should be homework3.zip

You are only allowed to use the following built-in terms/commands/functions: for, while if/elseif/else,

true, false, length. You can also use symbols such as *,< ==, [], +, :, basically anything that does not

require writing out in words. You may build your own functions which mimics pre-existing functions and

use them.

1. Write a function custom min(v) which takes as input a vector v and as output returns the smallest

element of v. For example custom min([1 2 -3 -2]) will return -3. (Don’t use min())

2. Write a function remove elt(v,n) that takes as input a vector v and a number n and as output returns

a vector that is the same as v but with the single value of n removed. For example, remove elt([-2 1 3

1 5], 1), then the output should be either [-2 3 1 5] or [-2 1 3 5].

3. Write a function custom sort(v) that takes as input a vector v and as output returns the vector v sorted

into increasing order.

4. Write a function is sorted(v) that returns true if v is sorted in increasing order and returns false

otherwise.

5. Write a function backwards sort(v) that takes as input a vector v and as output returns the vector v

sorted into decreasing order.

1


版权所有:编程辅导网 2021 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp