首页 > > 详细

讲解Canvas留学生、讲解Matlab语言、辅导Matlab程序设计 讲解留学生Processing|讲解数据库SQL

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

联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!