我目前正在研究Matlab代码,该代码使用离散方程。但是,为了同步某些数据,我应该将离散变量转换为连续变量,并与其他采样时间离散化,如图片from discrete to continuous所示。
您知道我可以使用哪种函数将这些离散变量转换为连续变量吗? 谢谢。
代码:
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);