Category: Matlab
Category Archives: Matlab
I do not have the ‘Editor’ tab available on my Matlab program, is there any way I could display it so I could easily run my code?
Hello all,
I’m having the problem of running my code. I have Matlab on my laptop and I recently installed it on my desktop at home. However, some things differ from the programs on my laptop and desktop. My laptop has the following tabs available, ‘Home’, ‘Plots’, ‘Apps’, ‘Editor’, ‘Publish’, ‘View’. Whereas my desktop only has ‘Home’, ‘Plots’, and ‘Apps’ and I cannot run my code since I don’t have all the tabs available, does anybody know how I can get this working on my desktop? Thanks in advance!
-Matlab NewbieHello all,
I’m having the problem of running my code. I have Matlab on my laptop and I recently installed it on my desktop at home. However, some things differ from the programs on my laptop and desktop. My laptop has the following tabs available, ‘Home’, ‘Plots’, ‘Apps’, ‘Editor’, ‘Publish’, ‘View’. Whereas my desktop only has ‘Home’, ‘Plots’, and ‘Apps’ and I cannot run my code since I don’t have all the tabs available, does anybody know how I can get this working on my desktop? Thanks in advance!
-Matlab Newbie Hello all,
I’m having the problem of running my code. I have Matlab on my laptop and I recently installed it on my desktop at home. However, some things differ from the programs on my laptop and desktop. My laptop has the following tabs available, ‘Home’, ‘Plots’, ‘Apps’, ‘Editor’, ‘Publish’, ‘View’. Whereas my desktop only has ‘Home’, ‘Plots’, and ‘Apps’ and I cannot run my code since I don’t have all the tabs available, does anybody know how I can get this working on my desktop? Thanks in advance!
-Matlab Newbie tabs, editor MATLAB Answers — New Questions
Use the PyTorch Model Predict function block in the matlab2024a simulink module to import a neural network trained using pytorch.
Hi everyone, I am now going to use PyTorch Model Predict in matlab2024a,simulink to import the neural network trained in pytorch into simulink for robot dynamics control. My current environment configuration is: matlab2024a,conda environment python environment, interpreter version 3.9, pytorch version using the cpu version, the neural network has also been saved as cpu version.
Checking python at the matlab command line:
>>pyenv
ans =
PythonEnvironment – 属性:
Version: "3.9"
Executable: "C:Users64375.condaenvsconda_env_39python.exe"
Library: "C:Users64375.condaenvsconda_env_39python39.dll"
Home: "C:Users64375.condaenvsconda_env_39"
Status: Loaded
ExecutionMode: InProcess
ProcessID: "21020"
ProcessName: "MATLAB"
Import the neural network policy_net_matlab.pth file in the simulink module following the official tutorial, using the function torch.load(). The input and output dimensions are set to match the network parameters. No pre-processing and post-processing functions are loaded. Because they are not used. Clicking Run reports the following error as shown in the image:Hi everyone, I am now going to use PyTorch Model Predict in matlab2024a,simulink to import the neural network trained in pytorch into simulink for robot dynamics control. My current environment configuration is: matlab2024a,conda environment python environment, interpreter version 3.9, pytorch version using the cpu version, the neural network has also been saved as cpu version.
Checking python at the matlab command line:
>>pyenv
ans =
PythonEnvironment – 属性:
Version: "3.9"
Executable: "C:Users64375.condaenvsconda_env_39python.exe"
Library: "C:Users64375.condaenvsconda_env_39python39.dll"
Home: "C:Users64375.condaenvsconda_env_39"
Status: Loaded
ExecutionMode: InProcess
ProcessID: "21020"
ProcessName: "MATLAB"
Import the neural network policy_net_matlab.pth file in the simulink module following the official tutorial, using the function torch.load(). The input and output dimensions are set to match the network parameters. No pre-processing and post-processing functions are loaded. Because they are not used. Clicking Run reports the following error as shown in the image: Hi everyone, I am now going to use PyTorch Model Predict in matlab2024a,simulink to import the neural network trained in pytorch into simulink for robot dynamics control. My current environment configuration is: matlab2024a,conda environment python environment, interpreter version 3.9, pytorch version using the cpu version, the neural network has also been saved as cpu version.
Checking python at the matlab command line:
>>pyenv
ans =
PythonEnvironment – 属性:
Version: "3.9"
Executable: "C:Users64375.condaenvsconda_env_39python.exe"
Library: "C:Users64375.condaenvsconda_env_39python39.dll"
Home: "C:Users64375.condaenvsconda_env_39"
Status: Loaded
ExecutionMode: InProcess
ProcessID: "21020"
ProcessName: "MATLAB"
Import the neural network policy_net_matlab.pth file in the simulink module following the official tutorial, using the function torch.load(). The input and output dimensions are set to match the network parameters. No pre-processing and post-processing functions are loaded. Because they are not used. Clicking Run reports the following error as shown in the image: python, simulink MATLAB Answers — New Questions
How to fit power-law to each column of data arranged in a table?
Hello all! Here my question:
I have a table displaying 1000 columns (spikes_mtx). Each column has 400 rows of data displaying exponential decay over 100s time (std_time).
I’d like to fit a three-coefficient power-fit model (y = a*x^b+c) to each column so as to obtain:
A table with x1000 a coefficient (coming from the 1000 exponential decays)
A table with x1000 b coefficient (coming from the 1000 exponential decays)
A table with x1000 c coefficient (coming from the 1000 exponential decays)
A table with x1000 fit goodness parameters (coming from the 1000 exponential decays)
All tables stored in one single structure (results.STD). My code doesn’t function, any recommendation? Thanks in advance!
ft = fittype( ‘power2’ ); % Power Fit: y = a*x^b+c
opts = fitoptions(ft); % Power fit options
opts.StartPoint = [1 -1 0];
opts.Lower = [0 -Inf -Inf];
opts.Upper = [Inf 0 Inf];
for i=1:length (spikes_mtx)
[xData, yData] = prepareCurveData(std_time,spikes_mtx(:,i)); % x = std_time y = spikes_mtx
[fitresult, gof] = fit( xData, yData, ft, opts ); % Goodnes of the Fit R^2
results.STD.Coeff.a(1,i)=S.std.fitmodel.a;
results.STD.Coeff.b(1,i)=S.std.fitmodel.b;
results.STD.Coeff.c(1,i)=S.std.fitmodel.c;
results.STD.gof.sse(1,i)=S.std.gof.sse;
results.STD.gof.rsquare(1,i)=S.std.gof.rsquare;
results.STD.gof.dfe(1,i)=S.std.gof.dfe;
results.STD.gof.adjrsquare(1,i)=S.std.gof.adjrsquare;
results.STD.gof.rmse(1,i)=S.std.gof.rmse;
endHello all! Here my question:
I have a table displaying 1000 columns (spikes_mtx). Each column has 400 rows of data displaying exponential decay over 100s time (std_time).
I’d like to fit a three-coefficient power-fit model (y = a*x^b+c) to each column so as to obtain:
A table with x1000 a coefficient (coming from the 1000 exponential decays)
A table with x1000 b coefficient (coming from the 1000 exponential decays)
A table with x1000 c coefficient (coming from the 1000 exponential decays)
A table with x1000 fit goodness parameters (coming from the 1000 exponential decays)
All tables stored in one single structure (results.STD). My code doesn’t function, any recommendation? Thanks in advance!
ft = fittype( ‘power2’ ); % Power Fit: y = a*x^b+c
opts = fitoptions(ft); % Power fit options
opts.StartPoint = [1 -1 0];
opts.Lower = [0 -Inf -Inf];
opts.Upper = [Inf 0 Inf];
for i=1:length (spikes_mtx)
[xData, yData] = prepareCurveData(std_time,spikes_mtx(:,i)); % x = std_time y = spikes_mtx
[fitresult, gof] = fit( xData, yData, ft, opts ); % Goodnes of the Fit R^2
results.STD.Coeff.a(1,i)=S.std.fitmodel.a;
results.STD.Coeff.b(1,i)=S.std.fitmodel.b;
results.STD.Coeff.c(1,i)=S.std.fitmodel.c;
results.STD.gof.sse(1,i)=S.std.gof.sse;
results.STD.gof.rsquare(1,i)=S.std.gof.rsquare;
results.STD.gof.dfe(1,i)=S.std.gof.dfe;
results.STD.gof.adjrsquare(1,i)=S.std.gof.adjrsquare;
results.STD.gof.rmse(1,i)=S.std.gof.rmse;
end Hello all! Here my question:
I have a table displaying 1000 columns (spikes_mtx). Each column has 400 rows of data displaying exponential decay over 100s time (std_time).
I’d like to fit a three-coefficient power-fit model (y = a*x^b+c) to each column so as to obtain:
A table with x1000 a coefficient (coming from the 1000 exponential decays)
A table with x1000 b coefficient (coming from the 1000 exponential decays)
A table with x1000 c coefficient (coming from the 1000 exponential decays)
A table with x1000 fit goodness parameters (coming from the 1000 exponential decays)
All tables stored in one single structure (results.STD). My code doesn’t function, any recommendation? Thanks in advance!
ft = fittype( ‘power2’ ); % Power Fit: y = a*x^b+c
opts = fitoptions(ft); % Power fit options
opts.StartPoint = [1 -1 0];
opts.Lower = [0 -Inf -Inf];
opts.Upper = [Inf 0 Inf];
for i=1:length (spikes_mtx)
[xData, yData] = prepareCurveData(std_time,spikes_mtx(:,i)); % x = std_time y = spikes_mtx
[fitresult, gof] = fit( xData, yData, ft, opts ); % Goodnes of the Fit R^2
results.STD.Coeff.a(1,i)=S.std.fitmodel.a;
results.STD.Coeff.b(1,i)=S.std.fitmodel.b;
results.STD.Coeff.c(1,i)=S.std.fitmodel.c;
results.STD.gof.sse(1,i)=S.std.gof.sse;
results.STD.gof.rsquare(1,i)=S.std.gof.rsquare;
results.STD.gof.dfe(1,i)=S.std.gof.dfe;
results.STD.gof.adjrsquare(1,i)=S.std.gof.adjrsquare;
results.STD.gof.rmse(1,i)=S.std.gof.rmse;
end preparecurvedata, power-law, exponential-decay MATLAB Answers — New Questions
Draw a line between a point, which has non-normalised coordinates, and a legend, which has a normalised position
I want to draw a line between a point (which has non-normalised coordinates) and a legend (which has a normalised position).
xp = 34573;
yp = 89832;
p = plot(xp,yp,’o’,’MarkerFaceColor’,’b’);
lgd = legend(p);
It would be easy if both the point coordinates and the legend position were either both normalised or both non-normalised. Indeed, I would like to use something similar to this:
plot([xp lgd.Position(1)],[yp lgd.Position(2)])
but it does not work, since they have a different normalization.
Therefore, is there a way to transform either the non-normalised coordinates into normalised coordinates, or viceversa?I want to draw a line between a point (which has non-normalised coordinates) and a legend (which has a normalised position).
xp = 34573;
yp = 89832;
p = plot(xp,yp,’o’,’MarkerFaceColor’,’b’);
lgd = legend(p);
It would be easy if both the point coordinates and the legend position were either both normalised or both non-normalised. Indeed, I would like to use something similar to this:
plot([xp lgd.Position(1)],[yp lgd.Position(2)])
but it does not work, since they have a different normalization.
Therefore, is there a way to transform either the non-normalised coordinates into normalised coordinates, or viceversa? I want to draw a line between a point (which has non-normalised coordinates) and a legend (which has a normalised position).
xp = 34573;
yp = 89832;
p = plot(xp,yp,’o’,’MarkerFaceColor’,’b’);
lgd = legend(p);
It would be easy if both the point coordinates and the legend position were either both normalised or both non-normalised. Indeed, I would like to use something similar to this:
plot([xp lgd.Position(1)],[yp lgd.Position(2)])
but it does not work, since they have a different normalization.
Therefore, is there a way to transform either the non-normalised coordinates into normalised coordinates, or viceversa? coordiantes, position, line, normalised, normalised coordiantes, non-normalised, non-normalised coordiantes MATLAB Answers — New Questions
how to achieve parameter sharing in the deep learning design?
in the deep learing design, is there a way to achieve an intermidiate layer, and this layer can accept varied length of inputs, each input is processed using the same learnable parameters.in the deep learing design, is there a way to achieve an intermidiate layer, and this layer can accept varied length of inputs, each input is processed using the same learnable parameters. in the deep learing design, is there a way to achieve an intermidiate layer, and this layer can accept varied length of inputs, each input is processed using the same learnable parameters. neural network, parameter sharing MATLAB Answers — New Questions
Simulink running despite error message
So, I have the following issue, that confuses me. I have simulink model to compare different controller (in Variant Subsystems). I use mainly MATLAB Function Blocks to implement those controllers. For one controller, however, simulink throws me an error message:
This is the only error message and it doesn’t make sense to me. But the simulation completes normally, and all the values seem correct. I could also set breakpoints and check on the matrix dimensions:
I am wondering if anybody had same issue and what causes it? I could just ignore it, but this does not seem right for me. I would rather fix this.So, I have the following issue, that confuses me. I have simulink model to compare different controller (in Variant Subsystems). I use mainly MATLAB Function Blocks to implement those controllers. For one controller, however, simulink throws me an error message:
This is the only error message and it doesn’t make sense to me. But the simulation completes normally, and all the values seem correct. I could also set breakpoints and check on the matrix dimensions:
I am wondering if anybody had same issue and what causes it? I could just ignore it, but this does not seem right for me. I would rather fix this. So, I have the following issue, that confuses me. I have simulink model to compare different controller (in Variant Subsystems). I use mainly MATLAB Function Blocks to implement those controllers. For one controller, however, simulink throws me an error message:
This is the only error message and it doesn’t make sense to me. But the simulation completes normally, and all the values seem correct. I could also set breakpoints and check on the matrix dimensions:
I am wondering if anybody had same issue and what causes it? I could just ignore it, but this does not seem right for me. I would rather fix this. simulink MATLAB Answers — New Questions
Random Number Generation with Parameters
Dear All,
Kindly ask for your assistant, I am trying to generate a time series with approx 500 data with the following parameters
1)values between min=0 max=1500
2) 0-100 range 50% of total data, 101-200 25% of total data etc
3) x/x+1 data should be +/-10% at 20% of data, x/x+1 should be between +/-10% – +/-20 at 15% of total data etc
Any ideas will be highly appreciatedDear All,
Kindly ask for your assistant, I am trying to generate a time series with approx 500 data with the following parameters
1)values between min=0 max=1500
2) 0-100 range 50% of total data, 101-200 25% of total data etc
3) x/x+1 data should be +/-10% at 20% of data, x/x+1 should be between +/-10% – +/-20 at 15% of total data etc
Any ideas will be highly appreciated Dear All,
Kindly ask for your assistant, I am trying to generate a time series with approx 500 data with the following parameters
1)values between min=0 max=1500
2) 0-100 range 50% of total data, 101-200 25% of total data etc
3) x/x+1 data should be +/-10% at 20% of data, x/x+1 should be between +/-10% – +/-20 at 15% of total data etc
Any ideas will be highly appreciated random number generator, discrete distribution MATLAB Answers — New Questions
display the contents of the printt in a text area
hi, i want to display the contents of the printt in a text area
(THIS IS.AN EXAMPLE)
fprintf(" Sistema n.%d %s Ntrades diff %d n",i,string(predy.sis(i).Sistema),(predy.sis(i).Ntradess(end)-(predy.sis(i).NtradeLong(end)+predy.sis(i).NtradeShort(end))));
app.TextArea.Value=" " ??hi, i want to display the contents of the printt in a text area
(THIS IS.AN EXAMPLE)
fprintf(" Sistema n.%d %s Ntrades diff %d n",i,string(predy.sis(i).Sistema),(predy.sis(i).Ntradess(end)-(predy.sis(i).NtradeLong(end)+predy.sis(i).NtradeShort(end))));
app.TextArea.Value=" " ?? hi, i want to display the contents of the printt in a text area
(THIS IS.AN EXAMPLE)
fprintf(" Sistema n.%d %s Ntrades diff %d n",i,string(predy.sis(i).Sistema),(predy.sis(i).Ntradess(end)-(predy.sis(i).NtradeLong(end)+predy.sis(i).NtradeShort(end))));
app.TextArea.Value=" " ?? display the contents of the printt in a text area MATLAB Answers — New Questions
PV system not working after connecting to 9 bus network
Hello, how are you? I have a problem, I hope you’ll be able to help me.
The photovoltaic system circuit works normally when it works independently, but it does not work after the photovoltaic system is integrated with the 9-bus network, It does not respond, knowing that the sources are synchronous machines.Hello, how are you? I have a problem, I hope you’ll be able to help me.
The photovoltaic system circuit works normally when it works independently, but it does not work after the photovoltaic system is integrated with the 9-bus network, It does not respond, knowing that the sources are synchronous machines. Hello, how are you? I have a problem, I hope you’ll be able to help me.
The photovoltaic system circuit works normally when it works independently, but it does not work after the photovoltaic system is integrated with the 9-bus network, It does not respond, knowing that the sources are synchronous machines. asem alhayali MATLAB Answers — New Questions
Magic Formula in Multibody model
Hello,
I am using Magic Formula for contact forces in a Multibody Vehicle model (Simscape). The COG of vehicle is free to move about World Frame through a 6-DOF joint, where I kept the internal mechanics (stifness/damping to zero).
I have the following problem using Magic Formula. My body is bouncing to the ground the whole simulaiton time. Looking on the wheel forces through magic formula I get a sinus pfofile of Fz(front,rear) with not enough damping. Also after some time the front wheel Fz is to high that makes the front axle to bounce much and lose contact.
I tried to put some stifness and damping on the 6-DOF joint for Pz or change the .tir file vertical/stifness/damping. Only by giving a high Pz stifness to the joint makes the body move properly, however I see some weird response on the wheel Fz afterwards.
Could you please give me some advice or any ideas to solve that issue?Hello,
I am using Magic Formula for contact forces in a Multibody Vehicle model (Simscape). The COG of vehicle is free to move about World Frame through a 6-DOF joint, where I kept the internal mechanics (stifness/damping to zero).
I have the following problem using Magic Formula. My body is bouncing to the ground the whole simulaiton time. Looking on the wheel forces through magic formula I get a sinus pfofile of Fz(front,rear) with not enough damping. Also after some time the front wheel Fz is to high that makes the front axle to bounce much and lose contact.
I tried to put some stifness and damping on the 6-DOF joint for Pz or change the .tir file vertical/stifness/damping. Only by giving a high Pz stifness to the joint makes the body move properly, however I see some weird response on the wheel Fz afterwards.
Could you please give me some advice or any ideas to solve that issue? Hello,
I am using Magic Formula for contact forces in a Multibody Vehicle model (Simscape). The COG of vehicle is free to move about World Frame through a 6-DOF joint, where I kept the internal mechanics (stifness/damping to zero).
I have the following problem using Magic Formula. My body is bouncing to the ground the whole simulaiton time. Looking on the wheel forces through magic formula I get a sinus pfofile of Fz(front,rear) with not enough damping. Also after some time the front wheel Fz is to high that makes the front axle to bounce much and lose contact.
I tried to put some stifness and damping on the 6-DOF joint for Pz or change the .tir file vertical/stifness/damping. Only by giving a high Pz stifness to the joint makes the body move properly, however I see some weird response on the wheel Fz afterwards.
Could you please give me some advice or any ideas to solve that issue? magic formula, simscape, wheel forces MATLAB Answers — New Questions
how to get inverse ?
a = [1 2 3];
b = [3 2 1 ].’;
c = a*b;
aa = c*pinv(b) ;
i want to answer a = aa but i can’t
pleas~~~~a = [1 2 3];
b = [3 2 1 ].’;
c = a*b;
aa = c*pinv(b) ;
i want to answer a = aa but i can’t
pleas~~~~ a = [1 2 3];
b = [3 2 1 ].’;
c = a*b;
aa = c*pinv(b) ;
i want to answer a = aa but i can’t
pleas~~~~ inverse MATLAB Answers — New Questions
Polyspace unbalanced/nested critical sections
Hello,
I have a question regarding critical sections in the context of dynamic polyspace analysis (code-prover).
I have noticed that unbalanced locks for themselves appear not to create orange or red findings. Is this behavior intended?
BRHello,
I have a question regarding critical sections in the context of dynamic polyspace analysis (code-prover).
I have noticed that unbalanced locks for themselves appear not to create orange or red findings. Is this behavior intended?
BR Hello,
I have a question regarding critical sections in the context of dynamic polyspace analysis (code-prover).
I have noticed that unbalanced locks for themselves appear not to create orange or red findings. Is this behavior intended?
BR code prover, unbalanced locks, double locks MATLAB Answers — New Questions
How to convert the MATLAB code into the Python?
Hello,
I have a matlab code for the quantitative differential phase contrast imaging and the code is very big and complicated as well.
But the problem is the institute where I am working does not allow to use matlab and they have python and LabVIEW, so I would like to convert the matlab code to python or someone knows how to run the matlab code in python then it also be very helpful.
I have attached the main code.
Thank you.Hello,
I have a matlab code for the quantitative differential phase contrast imaging and the code is very big and complicated as well.
But the problem is the institute where I am working does not allow to use matlab and they have python and LabVIEW, so I would like to convert the matlab code to python or someone knows how to run the matlab code in python then it also be very helpful.
I have attached the main code.
Thank you. Hello,
I have a matlab code for the quantitative differential phase contrast imaging and the code is very big and complicated as well.
But the problem is the institute where I am working does not allow to use matlab and they have python and LabVIEW, so I would like to convert the matlab code to python or someone knows how to run the matlab code in python then it also be very helpful.
I have attached the main code.
Thank you. matlab to python, matlab python interface MATLAB Answers — New Questions
Fill color inside stair.
Hi all, I has two figures are plotted together. I want to fille colors within stairs but don’t know how to do.
figure;
h1 = histogram(data1, ‘BinWidth’, 0.1,’DisplayStyle’,’stairs’,’Normalization’, ‘probability’);
h1.EdgeColor = ‘k’;
h1.LineWidth = 2;
% h1.FaceAlpha = 0.2;
hold on;
h2 = histogram(data2, ‘BinWidth’, 0.1,’DisplayStyle’,’stairs’,’Normalization’, ‘probability’);
h2.EdgeColor = [0.772, 0.012, 0.314];
h2.LineWidth = 2;
% h2.FaceAlpha = 0.2; %
xlim([0 2]);
xticks(0:0.1:2);
% Customize font and frame properties
ax = gca;
ax.FontSize = 16;
ax.FontWeight = ‘bold’;
ax.LineWidth = 4;Hi all, I has two figures are plotted together. I want to fille colors within stairs but don’t know how to do.
figure;
h1 = histogram(data1, ‘BinWidth’, 0.1,’DisplayStyle’,’stairs’,’Normalization’, ‘probability’);
h1.EdgeColor = ‘k’;
h1.LineWidth = 2;
% h1.FaceAlpha = 0.2;
hold on;
h2 = histogram(data2, ‘BinWidth’, 0.1,’DisplayStyle’,’stairs’,’Normalization’, ‘probability’);
h2.EdgeColor = [0.772, 0.012, 0.314];
h2.LineWidth = 2;
% h2.FaceAlpha = 0.2; %
xlim([0 2]);
xticks(0:0.1:2);
% Customize font and frame properties
ax = gca;
ax.FontSize = 16;
ax.FontWeight = ‘bold’;
ax.LineWidth = 4; Hi all, I has two figures are plotted together. I want to fille colors within stairs but don’t know how to do.
figure;
h1 = histogram(data1, ‘BinWidth’, 0.1,’DisplayStyle’,’stairs’,’Normalization’, ‘probability’);
h1.EdgeColor = ‘k’;
h1.LineWidth = 2;
% h1.FaceAlpha = 0.2;
hold on;
h2 = histogram(data2, ‘BinWidth’, 0.1,’DisplayStyle’,’stairs’,’Normalization’, ‘probability’);
h2.EdgeColor = [0.772, 0.012, 0.314];
h2.LineWidth = 2;
% h2.FaceAlpha = 0.2; %
xlim([0 2]);
xticks(0:0.1:2);
% Customize font and frame properties
ax = gca;
ax.FontSize = 16;
ax.FontWeight = ‘bold’;
ax.LineWidth = 4; histogram MATLAB Answers — New Questions
Derivative of state is not finite (integrator error)
Hi,
I am currently feacing a problem with my simulink model. The model is a complex network where I need to calculate and pass mass flow and pressures through several subsystems. The model works fine for some situations, with spesific inputs (mass flows), but with large variation in the inputs I get the following error message:
I have tried a lot of differet approaches to resolve the problem, among other things;
Reduce the fixed step size.
Tightening the error tolerances.
Using unit delay block or a swich block.
Creating Self-Resetting integrators, but then this error occured: "State ports can only be used to break algebraic loops or to "hand-off " states between systems."
Using different solvers such as ode15s, ode45 and odeN.
This has worked for some situations, but then the error reoccurs with a different input later on.
The error occurs in the integrator block in the following subsystem:
I would really appreciate some guidance on this problem, it would really help me out a lot. Thank you in advance.Hi,
I am currently feacing a problem with my simulink model. The model is a complex network where I need to calculate and pass mass flow and pressures through several subsystems. The model works fine for some situations, with spesific inputs (mass flows), but with large variation in the inputs I get the following error message:
I have tried a lot of differet approaches to resolve the problem, among other things;
Reduce the fixed step size.
Tightening the error tolerances.
Using unit delay block or a swich block.
Creating Self-Resetting integrators, but then this error occured: "State ports can only be used to break algebraic loops or to "hand-off " states between systems."
Using different solvers such as ode15s, ode45 and odeN.
This has worked for some situations, but then the error reoccurs with a different input later on.
The error occurs in the integrator block in the following subsystem:
I would really appreciate some guidance on this problem, it would really help me out a lot. Thank you in advance. Hi,
I am currently feacing a problem with my simulink model. The model is a complex network where I need to calculate and pass mass flow and pressures through several subsystems. The model works fine for some situations, with spesific inputs (mass flows), but with large variation in the inputs I get the following error message:
I have tried a lot of differet approaches to resolve the problem, among other things;
Reduce the fixed step size.
Tightening the error tolerances.
Using unit delay block or a swich block.
Creating Self-Resetting integrators, but then this error occured: "State ports can only be used to break algebraic loops or to "hand-off " states between systems."
Using different solvers such as ode15s, ode45 and odeN.
This has worked for some situations, but then the error reoccurs with a different input later on.
The error occurs in the integrator block in the following subsystem:
I would really appreciate some guidance on this problem, it would really help me out a lot. Thank you in advance. integration, derivative, simulink, algebraic loop, error, model MATLAB Answers — New Questions
How to exclude a certain value from a range?
Suppose a variable has upper limit and lower limit of 1 and 54 [1 54] and I and to exclude one value say 30 from it. How to it?
For example:
a = [0 576;0 100; 0 140;0 100;0 550;0 100;0 410];
b = [0.95 1.1;0.95 1.1;0.95 1.1;0.95 1.1;0.95 1.1;0.95 1.1;0.95 1.1];
c = [0.9 1.1;0.9 1.1;0.9 1.1;0.9 1.1;0.9 1.1;0.9 1.1;0.9 1.1;0.9 1.1;0.9 1.1;0.9 1.1;0.9 1.1;0.9 1.1;0.9 1.1;0.9 1.1;0.9 1.1;0.9 1.1;0.9 1.1];
d = [0 20;0 20;0 20];
e = [2 7; 2 7; 2 7];
limit = [a;b;c;d;e]’;
In this case from e, I want to exclude the value 6.Suppose a variable has upper limit and lower limit of 1 and 54 [1 54] and I and to exclude one value say 30 from it. How to it?
For example:
a = [0 576;0 100; 0 140;0 100;0 550;0 100;0 410];
b = [0.95 1.1;0.95 1.1;0.95 1.1;0.95 1.1;0.95 1.1;0.95 1.1;0.95 1.1];
c = [0.9 1.1;0.9 1.1;0.9 1.1;0.9 1.1;0.9 1.1;0.9 1.1;0.9 1.1;0.9 1.1;0.9 1.1;0.9 1.1;0.9 1.1;0.9 1.1;0.9 1.1;0.9 1.1;0.9 1.1;0.9 1.1;0.9 1.1];
d = [0 20;0 20;0 20];
e = [2 7; 2 7; 2 7];
limit = [a;b;c;d;e]’;
In this case from e, I want to exclude the value 6. Suppose a variable has upper limit and lower limit of 1 and 54 [1 54] and I and to exclude one value say 30 from it. How to it?
For example:
a = [0 576;0 100; 0 140;0 100;0 550;0 100;0 410];
b = [0.95 1.1;0.95 1.1;0.95 1.1;0.95 1.1;0.95 1.1;0.95 1.1;0.95 1.1];
c = [0.9 1.1;0.9 1.1;0.9 1.1;0.9 1.1;0.9 1.1;0.9 1.1;0.9 1.1;0.9 1.1;0.9 1.1;0.9 1.1;0.9 1.1;0.9 1.1;0.9 1.1;0.9 1.1;0.9 1.1;0.9 1.1;0.9 1.1];
d = [0 20;0 20;0 20];
e = [2 7; 2 7; 2 7];
limit = [a;b;c;d;e]’;
In this case from e, I want to exclude the value 6. optimization, logical indexing, masking MATLAB Answers — New Questions
Why do agents trained by the reinforcement learning PPO algorithm get different results each time they load?
In the process of reinforcement learning, a problem will be encountered. During the training process, an effective agent will appear. At this time, the training will be finished in advance, but the result of the saved agent running out will be worseIn the process of reinforcement learning, a problem will be encountered. During the training process, an effective agent will appear. At this time, the training will be finished in advance, but the result of the saved agent running out will be worse In the process of reinforcement learning, a problem will be encountered. During the training process, an effective agent will appear. At this time, the training will be finished in advance, but the result of the saved agent running out will be worse problems in reinforcement learning training MATLAB Answers — New Questions
Closed loop with LSTM for time series
Dear All
I am in troubling trying to perform a multi-ahead (closed loop) forecasting for a time series. I use Matlab2024 and the "old" command predictAndUpdate does not work with dlnetwork objects. I saw all the possible documentation, theoretically I can manage the question but practically not!. I sum up the excercise. Single univariate time serie (stock price) in LSTM net. No problem with trainnet and predict using historical training and test data. Now I’d like to go out of test data. This is the code
X = (XTest);
T = YTest;
%net2 is a dlnetwork object
offset = length(X);
[Z,state] = predict(net2,X(1:offset)); %predict and update state using test data
net2.State = state;
% five-steps ahead
numPredictionTimeSteps = 5;
Y = (zeros(numPredictionTimeSteps));
Y(1,:) = Z(end); %use the last forecast as starting point for the loop
for t = 2:numPredictionTimeSteps
[Y(:,t),state] = predict(net2,Y(:,t-1));
net2.State = state;
end
%I got:
Error using extractState (line 41)
If the hidden state argument is a matrix, then its number of observations must match the number of observations of the
input data.
I found a similar question on the web for the GRU net. If I restart the net before the loop (as suggested) it works but the forecast is very poor, so I wonder whether the restart can affect such a result. Is there an alternative to reset? I attach the data and the net.
thanks in advanceDear All
I am in troubling trying to perform a multi-ahead (closed loop) forecasting for a time series. I use Matlab2024 and the "old" command predictAndUpdate does not work with dlnetwork objects. I saw all the possible documentation, theoretically I can manage the question but practically not!. I sum up the excercise. Single univariate time serie (stock price) in LSTM net. No problem with trainnet and predict using historical training and test data. Now I’d like to go out of test data. This is the code
X = (XTest);
T = YTest;
%net2 is a dlnetwork object
offset = length(X);
[Z,state] = predict(net2,X(1:offset)); %predict and update state using test data
net2.State = state;
% five-steps ahead
numPredictionTimeSteps = 5;
Y = (zeros(numPredictionTimeSteps));
Y(1,:) = Z(end); %use the last forecast as starting point for the loop
for t = 2:numPredictionTimeSteps
[Y(:,t),state] = predict(net2,Y(:,t-1));
net2.State = state;
end
%I got:
Error using extractState (line 41)
If the hidden state argument is a matrix, then its number of observations must match the number of observations of the
input data.
I found a similar question on the web for the GRU net. If I restart the net before the loop (as suggested) it works but the forecast is very poor, so I wonder whether the restart can affect such a result. Is there an alternative to reset? I attach the data and the net.
thanks in advance Dear All
I am in troubling trying to perform a multi-ahead (closed loop) forecasting for a time series. I use Matlab2024 and the "old" command predictAndUpdate does not work with dlnetwork objects. I saw all the possible documentation, theoretically I can manage the question but practically not!. I sum up the excercise. Single univariate time serie (stock price) in LSTM net. No problem with trainnet and predict using historical training and test data. Now I’d like to go out of test data. This is the code
X = (XTest);
T = YTest;
%net2 is a dlnetwork object
offset = length(X);
[Z,state] = predict(net2,X(1:offset)); %predict and update state using test data
net2.State = state;
% five-steps ahead
numPredictionTimeSteps = 5;
Y = (zeros(numPredictionTimeSteps));
Y(1,:) = Z(end); %use the last forecast as starting point for the loop
for t = 2:numPredictionTimeSteps
[Y(:,t),state] = predict(net2,Y(:,t-1));
net2.State = state;
end
%I got:
Error using extractState (line 41)
If the hidden state argument is a matrix, then its number of observations must match the number of observations of the
input data.
I found a similar question on the web for the GRU net. If I restart the net before the loop (as suggested) it works but the forecast is very poor, so I wonder whether the restart can affect such a result. Is there an alternative to reset? I attach the data and the net.
thanks in advance lstm closed loop MATLAB Answers — New Questions
3D mandelbrot fractal with nodes that give information
Hello,
I’m building a 3D mandelbrot set with nodes that give information.
For example, if this was the equation:
Tree = Sum(n=1 to infinity) n^3 Sum (n=1 to infinity n^3) [ Integral (t=0 to infinity) TreeSpace^4 dTreeSpace/dt [Integral (t=0 to infinity) Carbon^4 dCarbon/dt + Integral (t=0 to infinity) Oxygen^4 dO/dt + Integral (t=0 to infinity) Nitrogen^4 dN/dt + Integral (t=0 to infinity) P^3 dP/dt]]
Then the mandelbrot set would be
for (C1=1 to infinity)
for (C2=1 to infinity)
for (C3=1 to infiinity)
for (C4 = 1 to infinity)
for (C5=1 to infinity)
for (C6=1 to infinity)
for (C7= 1 to infinity)
zn+1(series)=[zn^3+C1, zn^3+C2]
zn+1(treespace) = [zn^4(Carbon)dC/dt + C4, zn^4(O)dO/dt + C5, zn^4(N)dN/dt + C6, zn^4(P)dP/dt + C7]
End All for
And if the resulted 3D set is a tree I would be able to tell when the leaves fall and turn colors by hovering over the leaves. I would be able to tell when the tree root dies by hovering over the root. it would be color coded by elements.
I’m probably going to use this set: https://github.com/thargor6/mb3d
This is just a mockup, as the original is a trade secret and not a tree. Please advise. Need lots of help. Please walk me through one step at a time in Matlab. I don’t know if I got the zn+1’s right or how to use the github set.
Note, the first and second dimension of the fractal is the two infinite series. The third is the treespace, wrapped up in the elements by mandelbrot sets. it all happens over time.
I have matlab installed, standard Matlab. I can get a github subscription if needed, it’s only $4 a month. Let me know.
Look at these examples: https://idatavisualizationlab.github.io/researchProjects.html
Thank you.Hello,
I’m building a 3D mandelbrot set with nodes that give information.
For example, if this was the equation:
Tree = Sum(n=1 to infinity) n^3 Sum (n=1 to infinity n^3) [ Integral (t=0 to infinity) TreeSpace^4 dTreeSpace/dt [Integral (t=0 to infinity) Carbon^4 dCarbon/dt + Integral (t=0 to infinity) Oxygen^4 dO/dt + Integral (t=0 to infinity) Nitrogen^4 dN/dt + Integral (t=0 to infinity) P^3 dP/dt]]
Then the mandelbrot set would be
for (C1=1 to infinity)
for (C2=1 to infinity)
for (C3=1 to infiinity)
for (C4 = 1 to infinity)
for (C5=1 to infinity)
for (C6=1 to infinity)
for (C7= 1 to infinity)
zn+1(series)=[zn^3+C1, zn^3+C2]
zn+1(treespace) = [zn^4(Carbon)dC/dt + C4, zn^4(O)dO/dt + C5, zn^4(N)dN/dt + C6, zn^4(P)dP/dt + C7]
End All for
And if the resulted 3D set is a tree I would be able to tell when the leaves fall and turn colors by hovering over the leaves. I would be able to tell when the tree root dies by hovering over the root. it would be color coded by elements.
I’m probably going to use this set: https://github.com/thargor6/mb3d
This is just a mockup, as the original is a trade secret and not a tree. Please advise. Need lots of help. Please walk me through one step at a time in Matlab. I don’t know if I got the zn+1’s right or how to use the github set.
Note, the first and second dimension of the fractal is the two infinite series. The third is the treespace, wrapped up in the elements by mandelbrot sets. it all happens over time.
I have matlab installed, standard Matlab. I can get a github subscription if needed, it’s only $4 a month. Let me know.
Look at these examples: https://idatavisualizationlab.github.io/researchProjects.html
Thank you. Hello,
I’m building a 3D mandelbrot set with nodes that give information.
For example, if this was the equation:
Tree = Sum(n=1 to infinity) n^3 Sum (n=1 to infinity n^3) [ Integral (t=0 to infinity) TreeSpace^4 dTreeSpace/dt [Integral (t=0 to infinity) Carbon^4 dCarbon/dt + Integral (t=0 to infinity) Oxygen^4 dO/dt + Integral (t=0 to infinity) Nitrogen^4 dN/dt + Integral (t=0 to infinity) P^3 dP/dt]]
Then the mandelbrot set would be
for (C1=1 to infinity)
for (C2=1 to infinity)
for (C3=1 to infiinity)
for (C4 = 1 to infinity)
for (C5=1 to infinity)
for (C6=1 to infinity)
for (C7= 1 to infinity)
zn+1(series)=[zn^3+C1, zn^3+C2]
zn+1(treespace) = [zn^4(Carbon)dC/dt + C4, zn^4(O)dO/dt + C5, zn^4(N)dN/dt + C6, zn^4(P)dP/dt + C7]
End All for
And if the resulted 3D set is a tree I would be able to tell when the leaves fall and turn colors by hovering over the leaves. I would be able to tell when the tree root dies by hovering over the root. it would be color coded by elements.
I’m probably going to use this set: https://github.com/thargor6/mb3d
This is just a mockup, as the original is a trade secret and not a tree. Please advise. Need lots of help. Please walk me through one step at a time in Matlab. I don’t know if I got the zn+1’s right or how to use the github set.
Note, the first and second dimension of the fractal is the two infinite series. The third is the treespace, wrapped up in the elements by mandelbrot sets. it all happens over time.
I have matlab installed, standard Matlab. I can get a github subscription if needed, it’s only $4 a month. Let me know.
Look at these examples: https://idatavisualizationlab.github.io/researchProjects.html
Thank you. 3d, for, matlab, matlab coder, matlab code MATLAB Answers — New Questions
BeagleBone Support Package Linux Costumization
When I try to connect my BeagleBone to Matlab/Simulink using Matlab’s instructions (https://de.mathworks.com/help/supportpkg/beaglebone/ug/install-target-for-beaglebone-black-hardware.html) I manage to get until step 6 (under "Complete Setup Tasks"). As soon as I hit start to update the firmware, the wait bar reacts for a second before stopping and showing "Retry" on the button.
Has anyone come across the same problem and was able to solve it?When I try to connect my BeagleBone to Matlab/Simulink using Matlab’s instructions (https://de.mathworks.com/help/supportpkg/beaglebone/ug/install-target-for-beaglebone-black-hardware.html) I manage to get until step 6 (under "Complete Setup Tasks"). As soon as I hit start to update the firmware, the wait bar reacts for a second before stopping and showing "Retry" on the button.
Has anyone come across the same problem and was able to solve it? When I try to connect my BeagleBone to Matlab/Simulink using Matlab’s instructions (https://de.mathworks.com/help/supportpkg/beaglebone/ug/install-target-for-beaglebone-black-hardware.html) I manage to get until step 6 (under "Complete Setup Tasks"). As soon as I hit start to update the firmware, the wait bar reacts for a second before stopping and showing "Retry" on the button.
Has anyone come across the same problem and was able to solve it? beaglebone, embedded coder, linux MATLAB Answers — New Questions