I need to create a visual dashboard on Simulink
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hello everyone, I have the following matlab code. It runs perfectly and I receive no error codes and does what I want it to do.
load('ThreeClasses')
for i = 1:size(TestPoints,1)
X=TestPoints(i,2);
Y=TestPoints(i,3);
Delta1=log(P1)-0.5*mu1*inv(Sw)*mu1'+mu1*inv(Sw)*[X;Y];
Delta2=log(P2)-0.5*mu2*inv(Sw)*mu2'+mu2*inv(Sw)*[X;Y];
Delta3=log(P3)-0.5*mu3*inv(Sw)*mu3'+mu3*inv(Sw)*[X;Y];
pause(1)
clc
% The first initial d1 = 0 because there is no previous distance. It's the
% first one. The next d1 will have the previous value of d2.
try
d1;
catch
d1=0;
end
% The first initial t1 = 0 because there is no previous time. It's the
% first one. The next t1 will have the previous value of t2.
try
t1;
catch
t1=0;
end
%
d2=abs(B32 + A32*[X;Y]);sqrt(A32(1,1)^2+A32(1,2)^2);
t2=TestPoints(i,1); %time in seconds for the particular datapoint
%
%Calculating the Remaining Useful Life
RUL = d2*(t2-t1)/(d1-d2); % Units are in seconds
RUL_days=RUL/86400; % Units are in days
%
d1=d2;
t1=t2;
pause(1)
end
My problem now is that I want to show the (RUL) in simulink. I do have some experience in Simulink but all the simuluations I have done have been simple like second order mass-spring-dampener systems. My current matlab code calculates RUL based on the row that is being evaluated from the ThreeClasses file. This file is a (nx3) matrix. What my code does is it calculates the first RUL, pauses for 1 second then calculates the next RUL and so on and so on until based on the number of rows.
I want to do the same thing in Simulink.
I want to create like a block diagram or something; when I click run, it calculates the first RUL, pauses for 1 second, then shows the next one and so on and so on until all RUL's have been calculated and shown in Simulink.
Any help or suggestions are greatly appreciated.
0 Commenti
Risposte (0)
Vedere anche
Categorie
Scopri di più su Startup and Shutdown in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!