24小时热门版块排行榜    

CyRhmU.jpeg
查看: 234  |  回复: 2
当前主题已经存档。
【有奖交流】积极回复本帖子,参与交流,就有机会分得作者 ddx-k 的 5 个金币

ddx-k

荣誉版主 (著名写手)

骑士II

[交流] 【求助】如何做震荡曲线(光透射谱)的包络线?【已解决】

如果解决问题10金币奖励。

我测了一个薄膜的透射谱图,想根据透射谱计算出折射率等信息,需要做包络线
请问如何做一个震荡曲线的包络线?
就是把第一个图做成第二个图的样子??

[ Last edited by ddx-k on 2008-12-18 at 18:44 ]
回复此楼
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

baijinj

木虫 (小有名气)

这是一个matlab程序,你试一下

★ ★ ★ ★ ★ ★ ★
GrasaVampiro(金币+2,VIP+0):原创吗?
ddx-k(金币+5,VIP+0):谢谢你的帮助,我试下如果可以,金币补起!!1
function [up,down] = envelope(x,y,interpMethod)

%ENVELOPE gets the data of upper and down envelope of the known input (x,y).
%
%   Input parameters:
%    x               the abscissa of the given data
%    y               the ordinate of the given data
%    interpMethod    the interpolation method
%
%   Output parameters:
%    up      the upper envelope, which has the same length as x.
%    down    the down envelope, which has the same length as x.
%
%   See also DIFF INTERP1

%   Designed by: Lei Wang, <WangLeiBox@hotmail.com>, 11-Mar-2003.
%   Last Revision: 21-Mar-2003.
%   Dept. Mechanical & Aerospace Engineering, NC State University.
% $Revision: 1.1 $  $Date: 3/21/2003 10:33 AM $

if length(x) ~= length(y)
    error('Two input data should have the same length.');
end

if (nargin < 2)|(nargin > 3),
error('Please see help for INPUT DATA.');
elseif (nargin == 2)
    interpMethod = 'linear';
end


   
% Find the extreme maxim values
% and the corresponding indexes
%----------------------------------------------------
extrMaxValue = y(find(diff(sign(diff(y)))==-2)+1);
extrMaxIndex =   find(diff(sign(diff(y)))==-2)+1;



% Find the extreme minim values
% and the corresponding indexes
%----------------------------------------------------
extrMinValue = y(find(diff(sign(diff(y)))==+2)+1);
extrMinIndex =   find(diff(sign(diff(y)))==+2)+1;



up = extrMaxValue;
up_x = x(extrMaxIndex);

down = extrMinValue;
down_x = x(extrMinIndex);



% Interpolation of the upper/down envelope data
%----------------------------------------------------
up = interp1(up_x,up,x,interpMethod);
down = interp1(down_x,down,x,interpMethod);
无名小卒
2楼2008-12-17 16:12:38
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

ddx-k

荣誉版主 (著名写手)

骑士II

你的这段程序在网上能找到的,但是我matlab不会使用,自己安装了个,编译的时候总是通不过啊,有问题?!


谢谢,我试下,先感谢你的帮助,如果ok金币补起。

[ Last edited by ddx-k on 2008-12-18 at 09:45 ]
3楼2008-12-18 09:04:40
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 ddx-k 的主题更新
普通表情 高级回复(可上传附件)
信息提示
请填处理意见