声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 1511|回复: 2

[编程技巧] 给出x、y的一组数值,怎么用高斯拟合求出峰值坐标

[复制链接]
发表于 2012-7-24 10:10 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
clc;
clear all;
x=1:1:201;
y=[-35.08,-34.38,-33.7,-33.02,-32.26,-31.48,-30.69,-29.9,-29.13,-28.41,-27.68,-26.98,-26.31,-25.68,-25.07,-24.5,-23.98,-23.48,-23.02,-22.59,-22.2,-21.82,-21.49,-21.19,-20.93,-20.7,-20.49,-20.31,-20.14,-19.99,-19.85,-19.73,-19.56,-19.4,-19.22,-18.97,-18.66,-18.3,-17.88,-17.4,-16.86,-16.28,-15.66,-15.01,-14.39,-13.78,-13.18,-12.6,-12.05,-11.51,-11.05,-10.6,-10.2,-9.84,-9.51,-9.23,-8.98,-8.75,-8.53,-8.33,-8.16,-7.98,-7.89,-7.8,-7.69,-7.58,-7.47,-7.46,-7.41,-7.34,-7.27,-7.22,-7.14,-7.13,-7.13,-7.12,-7.1,-7.04,-7.04,-7.02,-6.99,-6.97,-6.99,-6.93,-6.96,-6.94,-6.92,-6.95,-6.99,-6.97,-6.97,-6.92,-6.88,-6.92,-6.93,-6.98,-6.96,-6.94,-6.96,-6.97,-6.92,-6.94,-6.96,-6.98,-6.99,-6.96,-7,-7.02,-7.04,-7.06,-7.06,-7.11,-7.13,-7.15,-7.2,-7.26,-7.26,-7.3,-7.34,-7.39,-7.44,-7.46,-7.54,-7.63,-7.68,-7.76,-7.88,-7.99,-8.05,-8.18,-8.3,-8.43,-8.57,-8.73,-8.97,-9.23,-9.32,-9.38,-9.59,-9.79,-10,-10.23,-10.47,-10.71,-10.96,-11.22,-11.48,-11.76,-12.06,-12.39,-12.73,-13.03,-13.38,-13.73,-14.1,-14.5,-14.9,-15.3,-15.73,-16.2,-16.69,-17.16,-17.63,-18.15,-18.66,-19.15,-19.65,-20.18,-20.73,-21.3,-21.85,-22.38,-22.91,-23.45,-24.02,-24.57,-25.1,-25.62,-26.11,-26.61,-27.09,-27.55,-27.97,-28.36,-28.74,-29.14,-29.51,-29.84,-30.17,-30.5,-30.79,-31.06,-31.32,-31.58,-31.84,-32.02,-32.23,-32.45,-32.67,-32.87,-33.02];
plot(x,y)

用公式 y=a*exp(-((x-x0)/c)^2)-y0进行曲线拟合,求出峰值点的坐标,怎么编程呢?
还有个问题,x0和y0的初始值怎么设,还是可以直接把拟合公式改写成 y=a*exp(-((x-b)/c)^2)    然后自己给出a,b,c的值?
不知道大家用高斯拟合的时候是怎么考虑和编写的,真心求指教!!


回复
分享到:

使用道具 举报

发表于 2012-7-24 23:36 | 显示全部楼层
 楼主| 发表于 2012-7-25 23:39 | 显示全部楼层
回复 2 # ChaChing 的帖子

谢谢哦!!
嘻嘻,后来鉴于线条的视觉效果和种类,我选择用origin实现了,感觉还不错。
当然了,matlab也可以做的。
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-11-11 01:20 , Processed in 0.064803 second(s), 18 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表