首页 > 解决方案 > 从离散变量转换为连续变量

问题描述

我目前正在研究 Matlab 代码,它使用离散方程。但是,要同步一些数据,我应该将离散变量转换为连续变量,并将其与其他采样时间离散,如图所示从离散到连续

您知道我可以使用哪种函数将这些离散变量转换为连续变量吗?谢谢你。

代码:


clear all; close all; clc; 
Bl=1/3; 
Br=1/3; 
Bt=1/3; 
a= 90/3600; %hours
b = 45; 
Ts = 1/3600; 
LEAVEa = [6000.*ones(1,b) 6000.*ones(1,(a*3600)-b)]; 
LEAVEa = repmat(LEAVEa',20,1);
LEAVEb = [6000.*ones(1,b) zeros(1,(a*3600)-b)]; 
LEAVEb = repmat(LEAVEb',20,1);

for Ka = 1:1:1800

    % Enter flow
  ENTERba(Ka) = (LEAVEa(Ka)*Bl)+ (LEAVEb(Ka)*Bt); %The flow rate entering link (b,a)
  ENT(Ka) = ENTERba(Ka)*Ts;  % sample time: 1s

end

%convert the discrete variable 'ENT' to continuous variable 

ENTc = d2c(ENT);

%convert the  continuous variable 'ENT' todiscrete variable with other
%sample time 15s
ENT1 = d2c(ENTc,15/3600);


标签: matlabdiscrete-mathematicscontinuous

解决方案


推荐阅读