0

我只想在 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));  
4

1 回答 1

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)

数据范围内的拟合数据

于 2013-06-18T19:15:07.020 回答