
matlab cody
yxnooo1
这个作者很懒,什么都没留下…
展开
-
matlab cody学习笔记 day23 判断输入的是否是向量
好久没更新了,今天刷一道(1)Problem 605. Whether the input is vector?Given the input x, return 1 if x is vector or else 0.我本来想的是获取X 的长度(length),如果是1的话,就不是向量,不知道为什么总是报错。答:y=isvector(x);最后只需要简单的一个函数就可以。。...原创 2021-03-23 10:46:56 · 1522 阅读 · 0 评论 -
matlab cody学习笔记 day22 计算阻尼正弦曲线
感觉还是把题号写好比较好,万一有人想参考,搜题号的时候就可以搜到吧。(1)Problem 44948. Calculate a Damped SinusoidThe equation of a damped sinusoid can be written asy = A.ⅇ^(-λt)*cos(2πft)whereA,λ, andfare scalars andtis a vector.Calculate the output sinusoidygiven the inp...原创 2021-03-11 09:14:47 · 1013 阅读 · 0 评论 -
matlab cody学习笔记 day21
GUI编程的任务暂时告一段落,现在又要开始每天刷一道题目的日子了。(1)Problem 13. Remove all the consonantsRemove all the consonants in the given phrase.Example:Input s1 = 'Jack and Jill went up the hill';Output s2 is 'a a i e u e i';要想去掉所有的辅音,就要构建一个包含所有辅音的数组,然后逐一进行判断。答:fun原创 2021-03-10 09:44:52 · 221 阅读 · 0 评论 -
matlab cody学习笔记 day20
终于上20天了,今天刷一道题目,之后打算把matlab GUI编程给记录一下,所以我之后这几天暂时不刷cody了。(1)Cell joinerYou are given a cell array of strings and a string delimiter. You need to produce one string which is composed of each string from the cell array separated by the delimiter.For ex原创 2021-03-04 08:51:18 · 479 阅读 · 1 评论 -
matlab cody学习笔记 day19
三月的第三天,眼睛疼(1)Nearest NumbersGiven a row vector of numbers, find the indices of the two nearest numbers.Examples:[index1 index2] = nearestNumbers([2 5 3 10 0 -3.1])index1 =1index2 =3[index1 index2] = nearestNumbers([-40 14 22 17])i原创 2021-03-03 09:51:59 · 316 阅读 · 0 评论 -
matlab cody学习笔记 day18
啊啊啊啊,陷入不想学习中无法自拔!(1)Verify Law of Large NumbersIf a large number of fair N-sided dice are rolled, the average of the simulated rolls is likely to be close to the mean of 1,2,...N i.e. the expected value of one die. For example, the expected value of a原创 2021-03-02 10:18:38 · 328 阅读 · 0 评论 -
matlab cody学习笔记 day17
三月的第一天从熬夜开始的,哭唧唧。(1)Target sortingSort the given list of numbersaaccording to how far away each element is from the target valuet. The result should return the list sorted in descending order of the absolute value of the difference betweena(n)and...原创 2021-03-01 10:50:47 · 138 阅读 · 0 评论 -
matlab cody学习笔记 day16
这道题目如果要理逻辑其实还挺麻烦的,所以打算好好理理这道题目(1)Find the longest sequence of 1's in a binary sequence.Given a string such ass = '011110010000000100010111'find the length of the longest string of consecutive 1's. In this example, the answer would be 4.Example:原创 2021-02-28 16:27:23 · 234 阅读 · 1 评论 -
matlab cody学习笔记 day15
今天有点其他的任务,刚好刷到一道简简单单的题目,就只做这道题目了(1)Getting the indices from a vectorThis is a basic MATLAB operation. It is for instructional purposes.---You may already know how tofind the logical indicesof the elements of a vector that meet your criteria.Thi..原创 2021-02-27 10:45:00 · 157 阅读 · 0 评论 -
matlab cody学习笔记 day14
之后打算每天只刷一道题目了,毕竟题目现在越来越不容易了,除了了解matlab函数适应matlab编程外,我还想把一些复杂题目的逻辑理清楚。(1)求两个向量的内积今天的第一道题目比较简单,可以用dot函数,也可以直接相乘,直接相乘的时候注意矩阵转置,这两种方法的时间复杂度是一样的。答:function z = your_fcn_name(x,y)z = dot(x,y);答:function z = your_fcn_name(x,y)z = x*y‘;(2)第二题也很简单原创 2021-02-26 08:34:18 · 263 阅读 · 0 评论 -
matlab cody学习笔记 day13
感觉现在的题目越来越难了,好想每日鸡汤激励一下自己好好学习,不要怕!(1)Which values occur exactly three times?Return a list of all values (sorted smallest to largest) that appear exactly three times in the input vector x. So ifx = [1 2 5 2 2 7 8 3 3 1 3 8 8 8]theny = [2 3]一些函数的学习:C原创 2021-02-25 09:12:16 · 298 阅读 · 0 评论