在matlab中对原始图的一部分进行曲线拟合

时间:2013-06-18 14:49:21

标签: matlab curve-fitting

我想仅在x为0.0001到0.007且y为0.00000001到0.0000009的部分中对此f图进行曲线拟合。我通过曲线拟合工具箱使用排除规则尝试了很多,但没有得到它。任何帮助将不胜感激。谢谢!

x =0:32/1024000:32;

m = ( x <= 16) .* ... % select the first part 
(  0.0133   0.00002./((cos(pi/4)./sinh(0.5*log(0.05*x))) coth(0.5*log(0.05*x))) )   ...
( x > 16) .* ... % select second part
(  0.0133   0.00002./((cos(pi/4)./sinh(0.5*log(0.05*(32-x)))) coth(0.5*log(0.05*(32-x)))) ) ; 

k = ( x <= 16) .* ... % select the first part
(  -0.00004*cos(pi/4)./(cosh(0.5*log(0.05*x))  sin(pi/4)) ) - ... 
( x > 16) .* ... % select second part
(  -0.00004*cos(pi/4)./(cosh(0.5*log(0.05*(32-x)))  sin(pi/4)) ) ; 

z = complex(m,k); 
y = ifft(z); 
f = abs(y);
figure(1);
plot(x,(f));  

1 个答案:

答案 0 :(得分:0)

您希望excludedata使用range方法名称运行。我无法理解你的功能所以这是一个例子:

% x1 and y1 defined over the entire range
x1 = 1:1000;
y1 = 100*sin(x1/500) + 10*rand(size(x1));

% exclude y values less than 20 and greater than 60
e = excludedata(x1', y1', 'range', [20,60]);

% calculate a linear fit
f = fit(x1', y1', 'poly1', 'Exclude', e);

figure
hold on
plot(f,x1,y1)

data with fit from a range of the data