フィルターのクリア

Variable step time with series of simulations in simulink - Plotting Difficulties

3 ビュー (過去 30 日間)
Hallo!
I have made an model where observ diffrent aspect of a PEMFC stack depending on load and temprature.
since each time i run the simulation the number of steps is different. Wich makes the specific Efficiency for that specific current uncompareble with the next simulation.
The only alternative i see is to run with a fixed value but that makes the simulation to take hours... All help with alternative suloutions is appriciated!
i put the code in the bottom.
Thanks in advance!
Here on left i tried to set a specific value like this:
surf(EffM)
xlabel('Current (A)','FontSize',12,'FontWeight','bold')
ylabel('Temp (C)','FontSize',12,'FontWeight','bold')
zlabel('Efficiency (%)','FontSize',12,'FontWeight','bold')
colormap(jet)
and on the right;
figure('Name','Eff LUT')
surf(CurrentM(1,:),tempA(2:Sweep+1),EffM)
xlabel('Current')
ylabel('Temp')
colormap(jet)
The hole code:
Tstart=0; % Starting time for the simulation [s]
Tstop=10;
Sweep=20;
Kelvin=273.15;
PEMTemp=301;
tempA=-50:10:150;
tempA=tempA+Kelvin;
t=length( time );
EffM=zeros(Sweep,t+40);
CurrentM=zeros(10,t+40);
VoltageM=zeros(Sweep,t+40);
H2flowM=zeros(Sweep,t+40);
ttempM=zeros(Sweep,t+40);
ttempM2=zeros(Sweep,11);
for x=1:Sweep
%for y=1:100
%Speed = SpeedA(y);
% PEMTemp44= tempA(x);
PEMTemp= tempA(x);
open_system('PEM_Dynamic_Temp_LUT')
set_param('PEM_Dynamic_Temp_LUT/Constant6', 'value', 'PEMTemp')
set_param('PEM_Dynamic_Temp_LUT', 'SimulationCommand', 'update');
sim('PEM_Dynamic_Temp_LUT',[Tstart,Tstop])
l2=length( Current );
lt=t+40-l2
tt=ones(lt,1);
CurrentM(x, :)= [Current ; tt];
VoltageM(x, :)= [Voltage ; tt];
EffM(x, :)=[Eff ; tt];
H2flowM(x, :)=[H2flow ; tt];
end

採用された回答

Arthur Roué
Arthur Roué 2020 年 3 月 16 日
You can interpolate your results with interp1 function or a griddedInterpolant object. This way, you'll always have the same points to compare your simulations.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeConverters (High Power) についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by