matlab normalise函数,使用Matlab中的polyfit函数对数据进行居中和缩放(Centering and scaling data using the polyfit functi...
使用Matlab中的polyfit函数对数据进行居中和缩放(Centering and scaling data using the polyfit function in Matlab)所以我有一长串的数据和我的项目,我需要找到一个最适合它的行。 我的教授建议使用[p,S,mu] = polyfit(x,n)对数据进行居中和缩放。 但是当我计算最佳拟合线时,我应该使用这个新数据。 我如何访问这些
使用Matlab中的polyfit函数对数据进行居中和缩放(Centering and scaling data using the polyfit function in Matlab)
所以我有一长串的数据和我的项目,我需要找到一个最适合它的行。 我的教授建议使用[p,S,mu] = polyfit(x,n)对数据进行居中和缩放。 但是当我计算最佳拟合线时,我应该使用这个新数据。 我如何访问这些数据? Matlab的帮助说它使用了一个公式(x-mu1)/ mu2。 因此,要使用修正的x值,我只需要替换yfit1 = polyval(coef1,x) ; 用(x-mu(1)/mu(2)) ?
So I have a long list of data and for my project and I need to find a line of best fit for it. My professor has recommended centering and scaling the data using [p,S,mu] = polyfit(x,n). But then when I compute the best fit line, I should be using this new data. How do I access this data? Matlab's help says that it uses a formula taking (x- mu1)/mu2. So to use the corrected x values I would just need to replace the x in yfit1 = polyval(coef1,x); with (x-mu(1)/mu(2))?
原文:https://stackoverflow.com/questions/23144265
更新时间:2020-01-30 13:54
最满意答案
对,那是正确的。 更换
yfit1 = polyval(coef1,x);
同
yfit1 = polyval(coef1,(x-mu(1))/mu(2));
Yes, that is correct. Replace
yfit1 = polyval(coef1,x);
with
yfit1 = polyval(coef1,(x-mu(1))/mu(2));
2017-06-23
相关问答
PH Richter,1995年,TDA进展报告42-122中的“估计最小二乘拟合中的误差”解决了这个问题。 从报告中,这一段可能已经足够给你 上面考虑的第一种情况,即确定一个或多个拟合参数的误差,具有根据拟合的协方差矩阵的对角线元素给出的直接答案,并且是众所周知的。 例如,您感兴趣的对角元素是: x = linspace(0,1,1000)
# comment and uncomment the last term to see how the fit appears in the figure
...
在搜索最佳拟合时,您需要使用原始数据x和y而不是其日志。 对数刻度仅用于表示结果。 在使用polyval之前,您需要对x进行排序。 使用普通轴时无关紧要,但由于序列错误,因此对象轴看起来很奇怪。 这是情节: 代码: x = [0.0090 0.0000 0.0001 0.0000 0.0001 0.0000 0.0097 0.0016 0.0006 0.0000 0.0016 0.0013 0.0023];
y = [0.0085 0.0001 0.0013 0.0006 0.0005 0.00
...
polyfit不是由scipy实现的。 scipy.__init__ 有一行 scipy.__init__ from numpy import *
这就是将名称拉入scipy命名空间的方式。 它没有任何区别,因为它们在内存中实际上是相同的对象: >>> import scipy
>>> import numpy
>>> scipy.polyfit is numpy.polyfit
True
你也可以切断中间人并使用numpy那个。 polyfit is not implemented by s
...
在执行线性回归,线性分类或逻辑回归之前,没有必要对数据进行标准化 - 尽管它不会造成任何伤害,但最终结果应该通过线性变换保持不变。 我认为你根本不需要绘制表面。 你有二维数据f(x,y) ,所以要将两者分开,你需要一条线。 It is not necessary to normalise your data before performing a linear regression, linear classification or logistic regression - although i
...
你的未知数是a和b ,它们在你的问题中都是线性的。 所以你可以使用一阶多项式拟合。 它已经是标准数学问题的形式。 要查看只是重命名 Y = a*X + b
使用已知的数据向量(或点) Y = 1/y
X = 1/x
就这样。 Your unknowns are aand b which are both linear in your problem. So you can use the 1st order polynomial fitting. It is already in the fo
...
这里的问题是你的第一个绘图是在1:length(q)的范围内绘制的,而第二个绘图是在0 : 1/fs : (length(wave)-1)/fs的范围内绘制的0 : 1/fs : (length(wave)-1)/fs 假设您的值q和wave1长度相同(看起来可能是这样),请尝试: figure; hold all;
plot(z, q);
plot(z, wave1);
然后,您可以根据自己的喜好调整每个绘图命令的线属性。 如果q和wave1的长度不完全相同,那么快速而肮脏的修复将是: fig
...
为了四舍五入,在polyfit方法中没有选择。 IIUC,你可以在应用polyfit后使用round 。 import numpy as np
data = [1,4,5,7,8,11,14,15,16,19]
x = np.arange(0,len(data))
y = np.array(data)
z = np.polyfit(x,y,2).round(decimals=3)
array([0.004, 1.905, 1.318])
对于值在整数十进制值之间的中间值,NumPy将舍入到最
...
您可以尝试不同的规范化方法。 常见的包括L-范数,有时也称为P范数或简单的线性范数 : L-1范数(曼哈顿范数)除以列的总和 L-2范数(欧几里德范数)除以列的欧氏长度 L-infinity范数(最大范数)除以列的最大值 更通用的方法称为特征选择或特征学习 。 这会尝试确定哪些功能对您的分类器有实际价值。 MATLAB中的特征选择方法? 提供了一些建议。 另一个常见的尝试是为SVM使用不同的内核。 内核将您的功能转换为不同的功能空间,这些功能空间可能(或可能不会)使您的SVM更加可分离。 Matl
...
对,那是正确的。 更换 yfit1 = polyval(coef1,x);
同 yfit1 = polyval(coef1,(x-mu(1))/mu(2));
Yes, that is correct. Replace yfit1 = polyval(coef1,x);
with yfit1 = polyval(coef1,(x-mu(1))/mu(2));
POLYFIT执行最小二乘 多项式拟合 ,归结为求解线性方程组 。 我做了一个快速搜索,但我找不到一个解决这类系统的基本线性代数Javascript库 ......最简单的方法是自己实现高斯消元法 。 POLYVAL简单地通过代入等式中的系数来评估点X处的多项式。 POLYFIT performs a least-square polynomial fitting which comes down to solving a system of linear equations. I did a q
...
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐


所有评论(0)