matlab设立阈值,matlab - 从polyfit图(Matlab)中提取给定y阈值的x值 - 堆栈内存溢出...

29602ba3b1e61de35f8165c0b6f33d49.pngaHR0cHM6Ly9pLnN0YWNrLmltZ3VyLmNvbS8yazRzeC5wbmc=

如实线和虚线所示,我想创建一个函数,在该函数中我从该阈值设置了y(强度)的阈值,它给了我相应的x值(虚线)。 非常简单,但我的while语句已关闭。 任何帮助将非常感激!

%% Curve fit plotting %%

x1 = timeStamps(1:60); % taking timestamps from 1 - 120 given smoothed y1 values

y1 = smooth(tic_lin(1:60),'sgolay',1);

% Find coefficients for polynomial (order = 4 and 6, respectively)

fitResults1 = polyfit(x1',y1, 7);

% evaluate the fitted y-values

yplot1 = polyval(fitResults1,x1');

% interpolates to find yi, the values of the underlying function Y at the points in the vector or array xi. x must be a vector.

Time_points = interp1(yplot1, x1', yplot1);

figure( 'Name', 'Curvefit1_poly' );

h = plot(x1', y1);%smoothed-points

hold on;

plot(x1', yplot1);%polyfit points

hold on;

plot(Time_points, yplot1, '*r');%interpolated points of x given y

%given y-threshold, output x(corresponding time_point).

broken = false;

while broken == false

if yplot1 >= 2024671226502.99

index = find(yplot1);

xDesired = x1(index);

broken = true;

else

disp("next iteration through");

end

end

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值