我有一个看起来像正弦曲线的实验测量,这样可以将函数建模为sin(x)
。如果我将asin
函数应用于数据,我会得到一个三角形函数。我想知道是否有一个表格可以像unwrap一样获得与x对应的直线。
任何意见将不胜感激。
答案 0 :(得分:1)
unwrap
仅适用于函数跳转的锯齿模式。所以我的想法是从你的函数创建这样一个锯齿模式,然后应用unwrap。
%example function
x=0:.1:10;
y=sin(x);
%invert
x1=asin(y);
%detect rising and falling
s=[true,diff(x1)>0];
%continue falling segments rising, using the negative slope
x2=x1.*s+(pi-x1).*(1-s);
%finally use unwrap
x3=unwrap(x2);
%code for the plot
%plot(x,y,x,x1,x,s,x,x2)
%legend({'y','x1','s','x2'})