matlab中归一化相关系数nc函数

matlab中归一化相关系数nc函数,第1张

1、相关系数就用命令corrcoef

min(min(corrcoef(x1, x2))) 就是x1,x2之间的相关系数。

比如

t = (1:01:100)';

w = 2pi;

x1=sin(wt)+randn(size(t));

x2=cos(wt)+randn(size(t));

x3=sin(wt)+randn(size(t));

x1_x2 = min(min(corrcoef(x1, x2)))

x1_x3 = min(min(corrcoef(x1, x3)))

2、用corrcoef函数

设a1,b1,c1,d1 ,a2,b2,c2,d2 分别为f(x)和g(x)的系数

x=[a1,b1,c1,d1];

y=[a2,b2,c2,d2];

z=corrcoef(x,y)

x = linspace(0,2000,2e5+1);

y = zeros(size(x));

y(x >= 0 & x <= 360) = 68;

y(x > 360 & x <= 693) = 68 + 018(x(x > 360 & x <= 693) - 360);

y(x > 693 & x < 800) = 128;

y(x >= 800 & x <= 1175) = 128 + 016(x(x >= 800 & x <= 1175) - 800);

y(x > 1175 & x < 1200) = 188;

y(x >= 1200) = 188 + 013(x(x >= 1200) - 1200);

如果报错,一般是字符类型问题,那么就需要用手打进matlab里面。

分段函数可以用if函数或者case写,我习惯用上面这种方式写,感觉相对简洁一些。

代码如下:前提,放置到form上一个text,2个option Private Sub Option1_Click() If Option1value = True Then Text1Enabled = False Else Text1Enabled = True End If End Sub Private Sub Option2_Click() If Option2value = True Then Text1Enabled = True Else Text1Enabled = False End If End Sub

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/langs/12155092.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-05-21
下一篇2023-05-21

发表评论

登录后才能评论

评论列表(0条)

    保存