![](https://img-blog.csdnimg.cn/20201109203509140.jpg?x-oss-process=image/resize,m_fixed,h_224,w_224)
Matlab
文章平均质量分 76
matlab的一些基础知识 或报错解决
Type真是太帅了
望崦嵫而勿迫兮,恐鹈鴂之先鸣。
展开
-
【代码复现|matlab】一种音频信号转换视觉颜色信息的方法及系统
5. 对幅度谱矩阵归一化,得到矩阵S,用于表示饱和度,此时HSV颜色空间三个维度的值均已获得;7. 计算块内所有信号的平均RGB值,作为这个块的颜色。专利对应:《一种音频信号转换视觉颜色信息的方法及系统》3. 对块进行傅里叶变换后,得到频率矩阵f和幅度谱F;4. 根据公式将频率矩阵转换为矩阵H,用于表示色相;6. 根据色相,计算块内每个信号对应的RGB值;2. 根据块的平均能量得到变量V,表示亮度;原创 2022-09-23 00:44:05 · 874 阅读 · 1 评论 -
Matlab逆滤波的空间域表示
我们都知道,在不考虑噪声的情况下,图像模糊模型为:。b表示模糊图像,f表示原始清晰图像,h表示模糊核,*表示卷积。根据空域-频域转换定理,空域的卷积等于频域的乘,空域的加减等于频域su的加减。所以,其频域表示为:,大写字母对应小写字母的频域。 如果已知模糊核h和模糊图像b,怎么求得原始图像s呢,答案是逆卷积。我们可以在频域进行等价变换:,并将h的频域得逆记作Φ,即其空域为φ,可以视作复原滤波器,使得f≈b*φ。 而如何得到这个复原滤波器φ呢?看似可以直...原创 2021-04-07 23:06:06 · 494 阅读 · 0 评论 -
Matlab:图像轮廓的曲率计算
给定一个连通区域的图像,如下图所示,想要求其轮廓像素点的曲率。理论上,下图红框中的轮廓像素的曲率应尽可能大,而蓝框的曲率应比较小。1.首先对图像二值化,并通过任意算子的边缘提取,得到初步的轮廓(白色像素点):I=im2bw(I);eg=edge(I,'canny');2.但可能存在某处的轮廓的“厚度”大于1,这样会影响之后按照顺序的轮廓点像素提取,所以对轮廓图像eg使用bwmorph进行细化:eg=bwmorph(eg,'thin',Inf);得到细化后的轮廓:..原创 2021-03-30 01:53:57 · 7737 阅读 · 7 评论 -
CODY Contest 2020 Basics - Triangles 全9题
第一题Problem 769. Calculate the area of a triangle between three pointsCalculate the area of a triangle between three points:P1(X1,Y1)P2(X2,Y2)P3(X3,Y3)these three points are the vertices of the triangle.给定三角形的三个点的坐标,求面积。首先求出P1~P3三个点的距离,即三角形...原创 2020-12-07 16:37:20 · 2078 阅读 · 0 评论 -
CODY Contest 2020 Basics on Cell Arrays 全10题
第一题Problem 41. 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 example, this inputin_cell = {'Lorem', 'ips...原创 2020-12-05 17:02:04 · 1628 阅读 · 0 评论 -
CODY Contest 2020 Basics - Binary Logic全10题
第一题Problem 15. 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:Input x = '110...原创 2020-12-05 14:44:06 · 1560 阅读 · 0 评论 -
CODY Contest 2020 Basics - Rounding 全10题
第一题Problem 42641. MATLAB Basic: roundingDo rounding near to zeroExample: -8.8, answer -8+8.1 answer 8想0四舍五入,即如果是正值,就向下取整(floor),如果是负值,就向上取整(ceil)function y = round_zero(x) if x<0 y=ceil(x); else y=floor(x); ...原创 2020-12-05 11:51:50 · 3087 阅读 · 3 评论 -
CODY Contest 2020 Project Euler I 全10题
第一题 Problem 230. Project Euler: Problem 1, Multiples of 3 and 5If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.Find the sum of all the multiples of 3 or 5 below the inp...原创 2020-12-04 19:05:35 · 2020 阅读 · 1 评论 -
CODY Contest 2020 Basics on Vectors 全11题
第一题Problem 3. Find the sum of all the numbers of the input vectorFind the sum of all the numbers of the input vector x.Examples:Input x = [1 2 3 5]Output y is 11Input x = [42 -1]Output y is 41输出给定向量的和。function ans = vecsum(x...原创 2020-12-03 19:02:51 · 1067 阅读 · 0 评论 -
CODY Contest 2020 MATLAB Onramp Practice 全15题
第一题Problem 1. Times 2 - START HERETry out this test problem first.Given the variable x as your input, multiply it by two and put the result in y.Examples:Input x = 2Output y is 4Input x = 17Output y is 34返回输入值的二倍function y = ti...原创 2020-12-03 18:02:59 · 6437 阅读 · 4 评论 -
CODY Contest 2020 CUP Challenge 全17题
第一题Problem 1974. Length of a short sideCalculate the length of the short side, a, of a right-angled triangle with hypotenuse of length c, and other short side of length b.给定直角(right-angled)三角形的斜边(hypotenuse)长c和一个短边长b,求另一个短边长a。直接用勾股定律qiu'de...原创 2020-12-03 16:11:36 · 2581 阅读 · 0 评论 -
CODY Contest 2020 Introduction to MATLAB 全24题(下)
第十三题 Problem 262. Swap the input argumentsWrite a two-input, two-output function that swaps its two input arguments. For example:[q,r] = swap(5,10)returns q = 10 and r = 5.返回的第一个元素的值等于第二个输入,返回的第二个等于第一个输入。function [q,r] = swapInputs(a,b) q=原创 2020-12-02 16:01:00 · 1468 阅读 · 0 评论 -
CODY Contest 2020 Introduction to MATLAB 全24题(上)
第一题 Problem 8. Add two numbersGiven a and b, return the sum a+b in c.返回两数之和。原创 2020-12-02 15:12:31 · 1526 阅读 · 0 评论 -
获得一维数据的峰值(C++/Matlab)
本方法源自于求解图像功率谱中某列(一维离散数据)的峰值之间的距离问题。比如输入的一维离散数据的分布如下:即从左到右,分别代表下标从1到n(c/python中为0到n-1)的数值大小,间隔为1,n表示输入一位数据的长度。在此对数据的峰重新定义:满足左右值都比它小的等值区间,比如[1,2,2,1]的[2,2]、[1,2,0]的[2]都是数据的“峰”,但[1,2,2,4]、[1,2,2,2]不存在峰。所有峰中最高的峰称作“主峰”,其他为“次峰”。对于以上的例子,所有峰已手动圈出。如图所示,共.原创 2020-11-12 21:40:08 · 2618 阅读 · 0 评论 -
matlab 未定义与‘XXX‘类型的输入参数相对应的函数‘princomp‘
今天某同学让我帮他看看matlab代码出了什么问题。首先运行代码,出现了第一个问题:这个GetSal函数是一个文件外的自定义函数,一看运行的当前目录和这个函数所在的目录不在同一个目录下,在代码里加入addpath(自定义函数所在目录)即可。加入这行代码,重新运行后出现第二个问题:princomp这个函数也是没有的,第一反应和第一个问题一样,结果在代码文件夹内并没有找到该函数,那么就有两个可能,第一是作者漏了,第二是系统函数。但是在命令框里搜索help princomp并没有结果:.原创 2020-11-09 20:30:10 · 12380 阅读 · 5 评论