• 实验数据处理


    来源

    加热冷却温度实验,相同实验参数可能有一次或多次重复实验,一次实验中也可能有多次。如何分别每一次周期,并把每个周期的数据都分析出来,成为一个问题。
    请添加图片描述

    解决思想

    1. 想根据冷却后的平台划分不同周期,但是由于冷却介质温度不同,平台数值也不同,并且部分时间冷却为到出现平台就进行了加热,只是达到 threshold就加热。
    2. 根据 相邻 数据点的 difference 分别,但是当加热功率小 冷却速度慢,采样频率高(200 Hz)相邻点的差值基本没有太大变化。
    3. 最终采取 第 N 个点 和 N+ Num 个点之间的斜率作为参考斜率,区分出加热过程冷却过程 和稳态过程, 并结合 peek 点 进一步判断斜率是不是在加热阶段和冷却阶段。 Num20, 采样频率200Hz, 实际只有0.1s。

    实现过程

    子文件夹及文件处理

    由于实验数据在 ‘.mat’ 文件中,改文件在root目录下的二级目录中。

    划分实验

    
    load(TemperatureMatFile, 'temperature_series');   	%  加载数据
    Time = temperature_series(1,:);
    T1   = temperature_series(3,:);
    
    % TF = ischange(T1, 'mean', 'Threshold',10);
    % pts=findchangepts(T1,'Statistic','linear','MinThreshold',30);
    
    % T1_med = medfilt1(T1,7);						% 数据平滑
    T1_med = transpose( smooth(T1,17) );
    NumThreshold = 20;          % compare the N+NumThreshold with N for slope
    T1_tmp = T1_med(NumThreshold+1 :end ) - T1_med(1:end-NumThreshold);
    T1_slope = T1_tmp / (0.005*NumThreshold); % 0.005 for 200 Hz sampling rate
    % T1_slope_smooth = medfilt1(T1_slope, 5);
    T1_slope_smooth = transpose( smooth(T1_slope, 17) );
    
    
    
    [pks,locs] = findpeaks(T1, 'MinPeakDistance', 1000, 'MinPeakHeight', 60) ; 		% 找到peek
    
    ind_1 = 1;
    ind_2 = ind_1;
    if isempty(locs)			% .mat 文件没有存储加热到60度的话直接丢弃,返回空
        ExpResult = struct.empty;
        return;
    end
    for i = 1:length(locs)
        ind_1 = ind_2;				% 一个文件中有多次实验,前一个实验冷却结束时间是后一次加热备选区间
        ind_2 = locs(i);
    
        % heating section
        index = false(1,(length(T1)-NumThreshold));
        index(ind_1:ind_2) = true;												% 本次分析所提取的数据,针对一个文件中有多次实验
        % heating start below 25 degC are not guaranteed
        heat_start = find(T1(index)<25, 1, 'last')+ ind_1;         
        if isempty(heat_start)						 % 由于加热不一定每次都是从 25度开始加热,
            heat_start = find(T1_slope_smooth(index)>2, 1, 'first') + ind_1;  %这个 大于2  是绘制了 斜率曲线后 决定的,需要尝试
        end
        heat_stop    = find(T1(index)<60, 1, 'last') + ind_1;
        
        heat_time(i)    = Time(heat_stop) - Time(heat_start);
        heat_T(i,1)  = T1(heat_start);
        heat_T(i,2)  = T1(heat_stop);
        heat_ind(i,1)= heat_start;
        heat_ind(i,2)= heat_stop;
        
        
        % cooling section
        index = false(1,(length(T1)-NumThreshold));
        index(ind_2:length(T1)-NumThreshold) = true;
        cool_start = find(T1(index)<60, 1, 'first') +ind_2;
        
        index(ind_2:cool_start) = false;        % cooling stop point larger than cooling start
        % cooling to 25 degC are not guaranteed
        cool_stop  = find(T1(index)<25, 1, 'first') +cool_start;
        if isempty(cool_stop)			%  cooling没有冷却到25度时 通过斜率判断是否稳定,0.2也是绘制斜率曲线后决定的。
            cool_stop  = find(T1_slope_smooth(index)<0.3 & T1_slope_smooth(index)>0.2, 1, 'first') +cool_start;
            if isempty(cool_stop)		% 如果没有 0.3  0.2之间的数,再次改变选取精度范围
                cool_stop  = find(T1_slope_smooth(index)<0.3 & T1_slope_smooth(index)>0, 1, 'first') +cool_start;
            end
        end
        
        cool_time(i)  = Time(cool_stop) - Time(cool_start);
        cool_T(i,1)  = T1(cool_start);
        cool_T(i,2)  = T1(cool_stop);
        cool_ind(i,1)= cool_start;
        cool_ind(i,2)= cool_stop;
    
        ind_2 = cool_stop;
          
    
    
    % idx = heat_ind(i,1):heat_ind(i,2);
    % plot(idx, T1(idx), '--r', 'LineWidth', 1.2);
    % idx = cool_ind(i,1):cool_ind(i,2);
    % plot(idx, T1(idx), '--b', 'LineWidth', 1.5);
    % disp('---')
    % pause(0.5)
    
    
    end
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82

    实验结果在 struct 中,怎么排序

    结构体转table,然后利用 sortrows() 排序,参考MATLAB 矩阵按不同行列排序

    实验结果

    下图中红色虚线是提取的加热阶段,蓝色虚线是选取的冷却阶段。蓝色虚线和红色虚线是有间隔的。通过调参可以控制加热夹断的选取和冷却阶段的选取。
    在这里插入图片描述

    在这里插入图片描述

  • 相关阅读:
    基于Label studio实现UIE信息抽取智能标注方案,提升标注效率!
    别再自己瞎写工具类了,Spring Boot 内置工具类应有尽有, 建议收藏
    Cloud 微服务
    石头剪刀布游戏(C语言)
    数字化技术促进传统产业升级,看供应链SCM系统如何赋能锂电池制造业降本增效
    如何使用Java进行安全测试?
    模拟量采集----测量输入的电压
    计算机组成与体系结构-进制转换
    C++ lambda表达式
    小程序进阶-长(多行)文本内容展开与收起、单行文本溢出隐藏
  • 原文地址:https://blog.csdn.net/jh1513/article/details/128008100