matlab - 从离散变量转换为连续变量
问题描述
我目前正在研究 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);
解决方案
推荐阅读
- python - 为什么它在出队时随机删除节点?
- java - 在 JSTL 中使用 EL exp 标记和 JSP 表达式标记之间的混淆
- python - 如何在 QDataWidgetMapper 中将字符串转换为日期格式?
- postgresql - Kubernetes 上的 HA PostgreSQL
- html - 如何计算js中表格不同行(tr)中的变量?
- python - 在 pythonanywhere 中重新加载 webapp 时出错
- node.js - node.js 中 require() 的路径参数
- sqlite - 当我想删除两行时,为什么 SQLAlchemy 在这里需要 6 行?
- javascript - 如何在Angular 9的html组件中的脚本中使用服务中的函数
- python - 如何在 Django 数据库中保存方程式和公式?