function UKF_main
close all;clear all;
clc; tic;
global n;
%---------------初始化---------------
stater0=[0.8;0.003];
state0=[0.8;0.012];
p=[0.001 0;0 0.001];
n=2;
SOCan=stater0(1);
stater=stater0;state=state0; xc=state;
staterout=[]; stateout=[];xcout=[];
errorout=[];tout=[];SOCa=[];erroroutA=[];
t0=1; h=1; tf=29877;
%---------------获取数据---------------
file='C:\Users\Administrator\Desktop\DST.xls';
[data text]=xlsread(file);
I=data(:,1);V=data(:,2);
SOC=data(:,3);
%---------------开始滤波---------------
for t=t0:h:tf
% [state,stater,yc]=track(state,stater);
yc=V(t);
I0=I(t);
[xc,p]=UKF_fiter(@systemfun,@measurefun,xc,yc,p,I0);
SOCan=SOCan+(I0*1.035/(19.6*3600));
error=xc(1,1)-SOC(t);
errorA=SOCan-SOC(t);
staterout=[staterout,SOC(t)];
errorout=[errorout,error];
erroroutA=[erroroutA,errorA];
xcout=[xcout,xc];
tout=[tout,t];
SOCa=[SOCa,SOCan];
end
%---------------状态信息图像---------------
figure;
plot(tout,xcout(1,:),'r',tout,staterout(1,:),'g',tout,SOCa(1,:),'b');
legend('UFK估算SOC值','真实SOC值','安时法估算SOC值');
grid on;
xlabel('时间(s)');
ylabel('SOC');
%title('无迹卡尔曼滤波');
figure;
plot(tout,xcout(2,:),'r');
grid on;
legend('滤波后');
xlabel('时间(s)');
ylabel('Up');
title('Up值');
figure;
plot(tout,errorout(1,:),'r',tout,erroroutA(1,:),'b');
grid on;
legend('UKF估算误差','安时法估算误差');
xlabel('时间(s)');
ylabel('估算误差');
%title('无迹卡尔曼滤波误差');
%---------------------------------------------
toc; %计算仿真程序运行时间
% xcout(2,:)
end
function state=systemfun(state0,I0)
%-------------------------
%系统方程
%-------------------------
F=[0.999994 0;0 0.9422];G=[0.000014161;-0.00026582];
state=F*state0+G*I0;
end
function yout=measurefun(state0,I0)
%----------------------------
%测量方程
%----------------------------
yout=-187.1*(state0(1))^8+802.1*(state0(1))^7-1436*(state0(1))^6+1398*(state0(1))^5-807.2*(state0(1))^4+...
282.7*(state0(1))^3-58.81*(state0(1))^2+6.821*(state0(1))^1+2.84...
+I0*0.0063-state0(2);
end
UKF实现SOC估计附matlab代码.zip
版权申诉
5星 · 超过95%的资源 151 浏览量
2022-04-28
22:44:38
上传
评论 3
收藏 2KB ZIP 举报
天天Matlab科研工作室
- 粉丝: 3w+
- 资源: 7259
最新资源
- 萤石云cp1-2c3wf
- 基于STM32的智能家庭火灾报警系统源码+演示ppt+演示视频(高分项目).zip
- 11. Django 常用的Web应用程序
- 萤石云固件CS-XP1-8B4WF
- HTML5小游戏【农场连连看-优秀H5小游戏合集】游戏源码分享下载 - farm.zip
- 基于Python的酒店评论情感分析源码+文档(高分项目).zip
- meta-llama-3-8b-instruct 的 model-00003-of-00004.safetensors 的3/3
- nginx配置文件,注意其中需要对应宿主机的路径
- 自用数据集自用数据集自用数据集
- HTML5小游戏【堆雪人-优秀H5小游戏合集】游戏源码分享下载 - epicsnowman.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
- 1
- 2
- 3
前往页