Category: Matlab
Category Archives: Matlab
How do I mesh a matlab model
I am trying to mesh a geometry. The geometry was modelled on matlab. Most meshing examples on matlab involve importing of the geometry. How do I mesh a model that was made in matlab. The model code as well as the mesh code has been given below.
rect1=[3
4
-530
530
530
-530
0
0
-530
-530];
C1=[1
0
0
228.6];
C2=[1
0
0
520.5];
C1 = [C1;zeros(length(rect1) – length(C1),1)];
C2 = [C2;zeros(length(rect1) – length(C2),1)];
gd = [C1,C2,rect1];
ns = (char(‘C1′,’C2′,’rect1’));
ns = ns’;
sf='(C2)-(C1+rect1)’;
dl = decsg(gd,sf,ns);
model = createpde("thermal","transient");
ge = geometryFromEdges(model,dl);
% 2D -> 3D extrusion
gd1 = extrude(ge,96);
figure
pdegplot(gd1,"FaceLabels","on")
model = femodel(Geometry="gd1");
model = generateMesh(model,Hmax=5,Hmin=1);
pdemesh(model)I am trying to mesh a geometry. The geometry was modelled on matlab. Most meshing examples on matlab involve importing of the geometry. How do I mesh a model that was made in matlab. The model code as well as the mesh code has been given below.
rect1=[3
4
-530
530
530
-530
0
0
-530
-530];
C1=[1
0
0
228.6];
C2=[1
0
0
520.5];
C1 = [C1;zeros(length(rect1) – length(C1),1)];
C2 = [C2;zeros(length(rect1) – length(C2),1)];
gd = [C1,C2,rect1];
ns = (char(‘C1′,’C2′,’rect1’));
ns = ns’;
sf='(C2)-(C1+rect1)’;
dl = decsg(gd,sf,ns);
model = createpde("thermal","transient");
ge = geometryFromEdges(model,dl);
% 2D -> 3D extrusion
gd1 = extrude(ge,96);
figure
pdegplot(gd1,"FaceLabels","on")
model = femodel(Geometry="gd1");
model = generateMesh(model,Hmax=5,Hmin=1);
pdemesh(model) I am trying to mesh a geometry. The geometry was modelled on matlab. Most meshing examples on matlab involve importing of the geometry. How do I mesh a model that was made in matlab. The model code as well as the mesh code has been given below.
rect1=[3
4
-530
530
530
-530
0
0
-530
-530];
C1=[1
0
0
228.6];
C2=[1
0
0
520.5];
C1 = [C1;zeros(length(rect1) – length(C1),1)];
C2 = [C2;zeros(length(rect1) – length(C2),1)];
gd = [C1,C2,rect1];
ns = (char(‘C1′,’C2′,’rect1’));
ns = ns’;
sf='(C2)-(C1+rect1)’;
dl = decsg(gd,sf,ns);
model = createpde("thermal","transient");
ge = geometryFromEdges(model,dl);
% 2D -> 3D extrusion
gd1 = extrude(ge,96);
figure
pdegplot(gd1,"FaceLabels","on")
model = femodel(Geometry="gd1");
model = generateMesh(model,Hmax=5,Hmin=1);
pdemesh(model) mesh MATLAB Answers — New Questions
Collision over-simplification in RST
Hello,
I am working with MATLAB to visualize the collision meshes of a robot I’ve designed. When using the show(robot) function, I notice that the collision meshes appear less detailed, I guess, the idea is to optimize execution time and reduce CPU load.
Could you please provide information on the maximum number of triangles allowed per STL file for collision meshes? I aim to achieve a balance between having detailed collision meshes and maintaining computational efficiency.
How it’s supposed to look like :
meshTri = stlread("concept_c-bras5_col.stl");
trisurf(meshTri)
axis equal
How it actually looks like :
rbt = importrobot("concept.urdf");
show(rbt,Collisions="on");
As you can see it’s really ugly. Do you know how to improve the collision meshes make them more accurate ?Hello,
I am working with MATLAB to visualize the collision meshes of a robot I’ve designed. When using the show(robot) function, I notice that the collision meshes appear less detailed, I guess, the idea is to optimize execution time and reduce CPU load.
Could you please provide information on the maximum number of triangles allowed per STL file for collision meshes? I aim to achieve a balance between having detailed collision meshes and maintaining computational efficiency.
How it’s supposed to look like :
meshTri = stlread("concept_c-bras5_col.stl");
trisurf(meshTri)
axis equal
How it actually looks like :
rbt = importrobot("concept.urdf");
show(rbt,Collisions="on");
As you can see it’s really ugly. Do you know how to improve the collision meshes make them more accurate ? Hello,
I am working with MATLAB to visualize the collision meshes of a robot I’ve designed. When using the show(robot) function, I notice that the collision meshes appear less detailed, I guess, the idea is to optimize execution time and reduce CPU load.
Could you please provide information on the maximum number of triangles allowed per STL file for collision meshes? I aim to achieve a balance between having detailed collision meshes and maintaining computational efficiency.
How it’s supposed to look like :
meshTri = stlread("concept_c-bras5_col.stl");
trisurf(meshTri)
axis equal
How it actually looks like :
rbt = importrobot("concept.urdf");
show(rbt,Collisions="on");
As you can see it’s really ugly. Do you know how to improve the collision meshes make them more accurate ? matlab MATLAB Answers — New Questions
vastly different optimization results from different matlab versions (r2023b,2021b,2020b)
[I just came across the problem and want to put down what I have for now. Will come back to improve the question once I narrow it down. THX]
I was solving a high-dimensional nonlinear optimization problem with self written gradient descent method. Running the exact same code (literally the same file, with no workspace or command window inputs), version 2023b gave me very different results from 2021b. I then compared with 2020b, which produced the same result as 2021b. Comparing the outputs, I found that 2023b calculated the gradient differently.
2020b and 2021b gave the following and converged after 18 iterations.
direction = [4.33783e-06 2.33596e-06 -5.33992e-06 -8.36479e-06 -9.19797e-05 1 ]
2023b gave the following and didn’t converge after 44 iterations.
direction = [4.17191e-06 2.24661e-06 -5.13617e-06 -7.53861e-06 -5.19154e-05 1 ]
The code is very slow, so I can’t let it run forever and find out when it will converge.
As far as I know, my code doesn’t involve any randomness. It does use a lot of matrices and high-order polynomials, as well as conditions.
I went through the release notes from r2021b onwards, and noticed a change to the round function, which I don’t use explicitly but can affect the conditions I suppose?round function change
There’re also some performance improvements on matrix calculations.[I just came across the problem and want to put down what I have for now. Will come back to improve the question once I narrow it down. THX]
I was solving a high-dimensional nonlinear optimization problem with self written gradient descent method. Running the exact same code (literally the same file, with no workspace or command window inputs), version 2023b gave me very different results from 2021b. I then compared with 2020b, which produced the same result as 2021b. Comparing the outputs, I found that 2023b calculated the gradient differently.
2020b and 2021b gave the following and converged after 18 iterations.
direction = [4.33783e-06 2.33596e-06 -5.33992e-06 -8.36479e-06 -9.19797e-05 1 ]
2023b gave the following and didn’t converge after 44 iterations.
direction = [4.17191e-06 2.24661e-06 -5.13617e-06 -7.53861e-06 -5.19154e-05 1 ]
The code is very slow, so I can’t let it run forever and find out when it will converge.
As far as I know, my code doesn’t involve any randomness. It does use a lot of matrices and high-order polynomials, as well as conditions.
I went through the release notes from r2021b onwards, and noticed a change to the round function, which I don’t use explicitly but can affect the conditions I suppose?round function change
There’re also some performance improvements on matrix calculations. [I just came across the problem and want to put down what I have for now. Will come back to improve the question once I narrow it down. THX]
I was solving a high-dimensional nonlinear optimization problem with self written gradient descent method. Running the exact same code (literally the same file, with no workspace or command window inputs), version 2023b gave me very different results from 2021b. I then compared with 2020b, which produced the same result as 2021b. Comparing the outputs, I found that 2023b calculated the gradient differently.
2020b and 2021b gave the following and converged after 18 iterations.
direction = [4.33783e-06 2.33596e-06 -5.33992e-06 -8.36479e-06 -9.19797e-05 1 ]
2023b gave the following and didn’t converge after 44 iterations.
direction = [4.17191e-06 2.24661e-06 -5.13617e-06 -7.53861e-06 -5.19154e-05 1 ]
The code is very slow, so I can’t let it run forever and find out when it will converge.
As far as I know, my code doesn’t involve any randomness. It does use a lot of matrices and high-order polynomials, as well as conditions.
I went through the release notes from r2021b onwards, and noticed a change to the round function, which I don’t use explicitly but can affect the conditions I suppose?round function change
There’re also some performance improvements on matrix calculations. version changes, different results MATLAB Answers — New Questions
Removing the grey margin of a plot (follow up question)
This is a follow-up question to Removing the grey margin of a plot. If I use the same code proposed by @KSSV within a subplot environment, the picture goes out the left margin (and probably the right margin as well):
subplot(1,2,1) % <– If I use subplotm the picture goes out the left (and maybe right) margin
plot(peaks)
title(‘Plot of Peaks Function’)
axis off
ax = gca;
outerpos = ax.OuterPosition;
ti = ax.TightInset;
left = outerpos(1) + ti(1);
bottom = outerpos(2) + ti(2);
ax_width = outerpos(3) – ti(1) – ti(3);
ax_height = outerpos(4) – ti(2) – ti(4);
ax.Position = [left bottom ax_width ax_height];
Is there a way to correctly adjust the left (and maybe the right) margin, in such a way that the entire figure lies inside the subplot?This is a follow-up question to Removing the grey margin of a plot. If I use the same code proposed by @KSSV within a subplot environment, the picture goes out the left margin (and probably the right margin as well):
subplot(1,2,1) % <– If I use subplotm the picture goes out the left (and maybe right) margin
plot(peaks)
title(‘Plot of Peaks Function’)
axis off
ax = gca;
outerpos = ax.OuterPosition;
ti = ax.TightInset;
left = outerpos(1) + ti(1);
bottom = outerpos(2) + ti(2);
ax_width = outerpos(3) – ti(1) – ti(3);
ax_height = outerpos(4) – ti(2) – ti(4);
ax.Position = [left bottom ax_width ax_height];
Is there a way to correctly adjust the left (and maybe the right) margin, in such a way that the entire figure lies inside the subplot? This is a follow-up question to Removing the grey margin of a plot. If I use the same code proposed by @KSSV within a subplot environment, the picture goes out the left margin (and probably the right margin as well):
subplot(1,2,1) % <– If I use subplotm the picture goes out the left (and maybe right) margin
plot(peaks)
title(‘Plot of Peaks Function’)
axis off
ax = gca;
outerpos = ax.OuterPosition;
ti = ax.TightInset;
left = outerpos(1) + ti(1);
bottom = outerpos(2) + ti(2);
ax_width = outerpos(3) – ti(1) – ti(3);
ax_height = outerpos(4) – ti(2) – ti(4);
ax.Position = [left bottom ax_width ax_height];
Is there a way to correctly adjust the left (and maybe the right) margin, in such a way that the entire figure lies inside the subplot? margin, subplot, outerposition, tightinset, margins MATLAB Answers — New Questions
Plot shows in legend but not in graph?
subplot(2,2,1);
plot(x1,y1,’bs’)
hold on
p1 = polyfit(x1,y1,35);
f1 = polyval(p1,x1);
plot(x1,f1,’–r’)
hold off
legend
title(‘Data Set 1’)
xlabel(‘X1 Values’)
ylabel(‘Y1 Values’)
subplot(2,2,2);
plot(x2,y2,’g*’)
hold on
p2 = polyfit(x2,y2,35);
f2 = polyval(p2,x2);
plot(x2,f2,’–b’)
hold off
legend
title(‘Data Set 2’)
xlabel(‘X2 Values’)
ylabel(‘Y2 Values’)subplot(2,2,1);
plot(x1,y1,’bs’)
hold on
p1 = polyfit(x1,y1,35);
f1 = polyval(p1,x1);
plot(x1,f1,’–r’)
hold off
legend
title(‘Data Set 1’)
xlabel(‘X1 Values’)
ylabel(‘Y1 Values’)
subplot(2,2,2);
plot(x2,y2,’g*’)
hold on
p2 = polyfit(x2,y2,35);
f2 = polyval(p2,x2);
plot(x2,f2,’–b’)
hold off
legend
title(‘Data Set 2’)
xlabel(‘X2 Values’)
ylabel(‘Y2 Values’) subplot(2,2,1);
plot(x1,y1,’bs’)
hold on
p1 = polyfit(x1,y1,35);
f1 = polyval(p1,x1);
plot(x1,f1,’–r’)
hold off
legend
title(‘Data Set 1’)
xlabel(‘X1 Values’)
ylabel(‘Y1 Values’)
subplot(2,2,2);
plot(x2,y2,’g*’)
hold on
p2 = polyfit(x2,y2,35);
f2 = polyval(p2,x2);
plot(x2,f2,’–b’)
hold off
legend
title(‘Data Set 2’)
xlabel(‘X2 Values’)
ylabel(‘Y2 Values’) subplot, multiple MATLAB Answers — New Questions
Linear Neural Network add another linear layer
I have written a program for training a linear neural network for classification. Both the input and the output are 3 row vectors and I need a each node to have a linear transfer function. I have used the linearlayer type as you can see in the code below;
function trainLNN(P, T)
%P = [1.7300 1.9500 2.3800; 1.4400 5.0000 4.7500; 3.4000 3.2000 3.3000];
%T = [ 0 1 0; 1 0 0; 0 0 1];
net = linearlayer;
net.trainParam.epochs = 1000;
net.trainParam.goal = 0.1;
net.trainParam.lr = 0.001;
net.trainParam.lr = maxlinlr(P,’bias’);
net = train(net,P, T);
What I get is a neural network with just an input and an output layer (see the photo below).
How can I extend that to add a hidden layer between the input and the output layers to have a network like the one in the photo with all nodes having a linear transfer function? I have tried net = linearlayer(P,T, 3, {‘purelin’, ‘purelin’}); but I get an error ("Too many parameter arguments");I have written a program for training a linear neural network for classification. Both the input and the output are 3 row vectors and I need a each node to have a linear transfer function. I have used the linearlayer type as you can see in the code below;
function trainLNN(P, T)
%P = [1.7300 1.9500 2.3800; 1.4400 5.0000 4.7500; 3.4000 3.2000 3.3000];
%T = [ 0 1 0; 1 0 0; 0 0 1];
net = linearlayer;
net.trainParam.epochs = 1000;
net.trainParam.goal = 0.1;
net.trainParam.lr = 0.001;
net.trainParam.lr = maxlinlr(P,’bias’);
net = train(net,P, T);
What I get is a neural network with just an input and an output layer (see the photo below).
How can I extend that to add a hidden layer between the input and the output layers to have a network like the one in the photo with all nodes having a linear transfer function? I have tried net = linearlayer(P,T, 3, {‘purelin’, ‘purelin’}); but I get an error ("Too many parameter arguments"); I have written a program for training a linear neural network for classification. Both the input and the output are 3 row vectors and I need a each node to have a linear transfer function. I have used the linearlayer type as you can see in the code below;
function trainLNN(P, T)
%P = [1.7300 1.9500 2.3800; 1.4400 5.0000 4.7500; 3.4000 3.2000 3.3000];
%T = [ 0 1 0; 1 0 0; 0 0 1];
net = linearlayer;
net.trainParam.epochs = 1000;
net.trainParam.goal = 0.1;
net.trainParam.lr = 0.001;
net.trainParam.lr = maxlinlr(P,’bias’);
net = train(net,P, T);
What I get is a neural network with just an input and an output layer (see the photo below).
How can I extend that to add a hidden layer between the input and the output layers to have a network like the one in the photo with all nodes having a linear transfer function? I have tried net = linearlayer(P,T, 3, {‘purelin’, ‘purelin’}); but I get an error ("Too many parameter arguments"); linear neural network, matlab, linearlayer MATLAB Answers — New Questions
MATLAB getMATFilesFromPixhawk Function Fails to Retrieve SD Card Data from Pixhawk PID Controller Simulation
I have been working on a PID controller for Pixhawk and encountered an issue when trying to retrieve MAT files from the SD card after optimizing and building the model in Simulink. Initially, I successfully logged signals to the SD card using the example px4-log and following the documentation. However, when applying the same steps to my PID controller project, I encountered an error when attempting to extract the MAT files using the getMATFilesFromPixhawk function. Despite running MATLAB as an administrator to avoid permission problems, the issue persists. I have tried various solutions without success. Do you have any ideas on how to resolve this?I have been working on a PID controller for Pixhawk and encountered an issue when trying to retrieve MAT files from the SD card after optimizing and building the model in Simulink. Initially, I successfully logged signals to the SD card using the example px4-log and following the documentation. However, when applying the same steps to my PID controller project, I encountered an error when attempting to extract the MAT files using the getMATFilesFromPixhawk function. Despite running MATLAB as an administrator to avoid permission problems, the issue persists. I have tried various solutions without success. Do you have any ideas on how to resolve this? I have been working on a PID controller for Pixhawk and encountered an issue when trying to retrieve MAT files from the SD card after optimizing and building the model in Simulink. Initially, I successfully logged signals to the SD card using the example px4-log and following the documentation. However, when applying the same steps to my PID controller project, I encountered an error when attempting to extract the MAT files using the getMATFilesFromPixhawk function. Despite running MATLAB as an administrator to avoid permission problems, the issue persists. I have tried various solutions without success. Do you have any ideas on how to resolve this? getmatfilesfrompixhawk, simulink, pixhawk, matlab function, simulation, export MATLAB Answers — New Questions
How to correct the recording of a daamaged accelerometer in earthquake analysis
Hello everyone,
I have the recording of two accelerometers but it turned out that one of them did not work properly and the recording is messed up (See photo, The two recordings should be the same). However I think if processed well I can recover the lost acclerogram. Does anyone have an idea how I can proceed. I have attached the recordings.
Thank you in advanceHello everyone,
I have the recording of two accelerometers but it turned out that one of them did not work properly and the recording is messed up (See photo, The two recordings should be the same). However I think if processed well I can recover the lost acclerogram. Does anyone have an idea how I can proceed. I have attached the recordings.
Thank you in advance Hello everyone,
I have the recording of two accelerometers but it turned out that one of them did not work properly and the recording is messed up (See photo, The two recordings should be the same). However I think if processed well I can recover the lost acclerogram. Does anyone have an idea how I can proceed. I have attached the recordings.
Thank you in advance accelerogram, earthquake, dynamic, engineering MATLAB Answers — New Questions
“library initialization failed – unable to allocate file descriptor table – out of memory MATLAB is exiting because of fatal error”
Hi!
I’m a Linux user and today I started receiving the following error message when launching MATLAB:
MATLAB is selecting SOFTWARE OPENGL rendering.
library initialization failed – unable to allocate file descriptor table – out of memory
MATLAB is exiting because of fatal error
[1] 10520 killed matlab
It was working correctly until now, not sure it could have something to do with a software update. However, if I execute matlab with the -nojvm flag it opens the console properly.
I’m using MATLAB R2023a in Debian trixie kernel version 6.7.12.
Thanks for your help!Hi!
I’m a Linux user and today I started receiving the following error message when launching MATLAB:
MATLAB is selecting SOFTWARE OPENGL rendering.
library initialization failed – unable to allocate file descriptor table – out of memory
MATLAB is exiting because of fatal error
[1] 10520 killed matlab
It was working correctly until now, not sure it could have something to do with a software update. However, if I execute matlab with the -nojvm flag it opens the console properly.
I’m using MATLAB R2023a in Debian trixie kernel version 6.7.12.
Thanks for your help! Hi!
I’m a Linux user and today I started receiving the following error message when launching MATLAB:
MATLAB is selecting SOFTWARE OPENGL rendering.
library initialization failed – unable to allocate file descriptor table – out of memory
MATLAB is exiting because of fatal error
[1] 10520 killed matlab
It was working correctly until now, not sure it could have something to do with a software update. However, if I execute matlab with the -nojvm flag it opens the console properly.
I’m using MATLAB R2023a in Debian trixie kernel version 6.7.12.
Thanks for your help! error, launch MATLAB Answers — New Questions
Data Extraction from SimBiology Simulations
What is the BEST way to get the simulation data out of simbiology and into excel or some other program?
I have found a brief explanation on how to export to Matlab area and then convert to XLS but its not working terrible wellWhat is the BEST way to get the simulation data out of simbiology and into excel or some other program?
I have found a brief explanation on how to export to Matlab area and then convert to XLS but its not working terrible well What is the BEST way to get the simulation data out of simbiology and into excel or some other program?
I have found a brief explanation on how to export to Matlab area and then convert to XLS but its not working terrible well simbiology, simulation MATLAB Answers — New Questions
What is the reason for error in HDL Coder and Cadence Stratus HLS tutorial?
Hi all,
I’m trying to complete this tutorial https://se.mathworks.com/help/hdlcoder/ug/get-started-with-matlab-to-hls-workflow-using-hdl-coder-app.html, but I get stuck in the Verification step in Workflow Advisor. I get this output in the Workflow Advisor window in Verification step (Verify with HLS Test Bench):
## Begin TestBench generation.
Code generation successful.
### Collecting data…
### Begin HDL test bench file generation with logged samples
### Generating test bench data file: x_in.dat.
### Generating test bench data file: y_out_expected.dat.
### Generating test bench data file: delayed_xout_expected.dat.
### Generating test bench file: mlhdlc_sfir_fixptClass_tb.hpp
### Running Stratus Importer on the generated testbench.
### Working on mlhdlc_sfir_fixpt_bdw_import_log.txt as mlhdlc_sfir_fixpt_bdw_import_log.txt.
Stratus Importer failed. See ‘mlhdlc_sfir_fixpt_bdw_import_log.txt’ for details.
Error in CadenceStratus>>generateBDWImportScripts at 0
Error in CadenceStratus>>postTBGen at 0
Error in HLSPostCodegenDriver>>postTBGen at 0
Error in Manager>>wfa_runHLSSimulation at 0
And following error message to Matlab Command window:
Error using emlhdlcoder.HLSDriver.Tools.CadenceStratus/generateBDWImportScripts
Stratus Importer failed. See ‘mlhdlc_sfir_fixpt_bdw_import_log.txt’ for
details.
Error in emlhdlcoder.HLSDriver.Tools.CadenceStratus/postTBGen
Error in emlhdlcoder.HLSDriver.HLSPostCodegenDriver/postTBGen
Error in emlhdlcoder.WorkFlow.Manager/wfa_runHLSSimulation
And here is the content of the ‘mlhdlc_sfir_fixpt_bdw_import_log.txt’ file is:
INFO: Searching /sw/rhel7/cadence/STRATUS2301 for template
WARNING: BDW_IMPORT_ML_CLOCK_FREQ = 0, using default 5.0.
INFO: Processing template tb.cc
FATAL ERROR: Unable to process template tb.cc
I’m using Matlab version R2024a and Cadence Stratus 23.01, but tested also with 22.01 which gave same error. What are the software versions that this tutorial is verified to work?Hi all,
I’m trying to complete this tutorial https://se.mathworks.com/help/hdlcoder/ug/get-started-with-matlab-to-hls-workflow-using-hdl-coder-app.html, but I get stuck in the Verification step in Workflow Advisor. I get this output in the Workflow Advisor window in Verification step (Verify with HLS Test Bench):
## Begin TestBench generation.
Code generation successful.
### Collecting data…
### Begin HDL test bench file generation with logged samples
### Generating test bench data file: x_in.dat.
### Generating test bench data file: y_out_expected.dat.
### Generating test bench data file: delayed_xout_expected.dat.
### Generating test bench file: mlhdlc_sfir_fixptClass_tb.hpp
### Running Stratus Importer on the generated testbench.
### Working on mlhdlc_sfir_fixpt_bdw_import_log.txt as mlhdlc_sfir_fixpt_bdw_import_log.txt.
Stratus Importer failed. See ‘mlhdlc_sfir_fixpt_bdw_import_log.txt’ for details.
Error in CadenceStratus>>generateBDWImportScripts at 0
Error in CadenceStratus>>postTBGen at 0
Error in HLSPostCodegenDriver>>postTBGen at 0
Error in Manager>>wfa_runHLSSimulation at 0
And following error message to Matlab Command window:
Error using emlhdlcoder.HLSDriver.Tools.CadenceStratus/generateBDWImportScripts
Stratus Importer failed. See ‘mlhdlc_sfir_fixpt_bdw_import_log.txt’ for
details.
Error in emlhdlcoder.HLSDriver.Tools.CadenceStratus/postTBGen
Error in emlhdlcoder.HLSDriver.HLSPostCodegenDriver/postTBGen
Error in emlhdlcoder.WorkFlow.Manager/wfa_runHLSSimulation
And here is the content of the ‘mlhdlc_sfir_fixpt_bdw_import_log.txt’ file is:
INFO: Searching /sw/rhel7/cadence/STRATUS2301 for template
WARNING: BDW_IMPORT_ML_CLOCK_FREQ = 0, using default 5.0.
INFO: Processing template tb.cc
FATAL ERROR: Unable to process template tb.cc
I’m using Matlab version R2024a and Cadence Stratus 23.01, but tested also with 22.01 which gave same error. What are the software versions that this tutorial is verified to work? Hi all,
I’m trying to complete this tutorial https://se.mathworks.com/help/hdlcoder/ug/get-started-with-matlab-to-hls-workflow-using-hdl-coder-app.html, but I get stuck in the Verification step in Workflow Advisor. I get this output in the Workflow Advisor window in Verification step (Verify with HLS Test Bench):
## Begin TestBench generation.
Code generation successful.
### Collecting data…
### Begin HDL test bench file generation with logged samples
### Generating test bench data file: x_in.dat.
### Generating test bench data file: y_out_expected.dat.
### Generating test bench data file: delayed_xout_expected.dat.
### Generating test bench file: mlhdlc_sfir_fixptClass_tb.hpp
### Running Stratus Importer on the generated testbench.
### Working on mlhdlc_sfir_fixpt_bdw_import_log.txt as mlhdlc_sfir_fixpt_bdw_import_log.txt.
Stratus Importer failed. See ‘mlhdlc_sfir_fixpt_bdw_import_log.txt’ for details.
Error in CadenceStratus>>generateBDWImportScripts at 0
Error in CadenceStratus>>postTBGen at 0
Error in HLSPostCodegenDriver>>postTBGen at 0
Error in Manager>>wfa_runHLSSimulation at 0
And following error message to Matlab Command window:
Error using emlhdlcoder.HLSDriver.Tools.CadenceStratus/generateBDWImportScripts
Stratus Importer failed. See ‘mlhdlc_sfir_fixpt_bdw_import_log.txt’ for
details.
Error in emlhdlcoder.HLSDriver.Tools.CadenceStratus/postTBGen
Error in emlhdlcoder.HLSDriver.HLSPostCodegenDriver/postTBGen
Error in emlhdlcoder.WorkFlow.Manager/wfa_runHLSSimulation
And here is the content of the ‘mlhdlc_sfir_fixpt_bdw_import_log.txt’ file is:
INFO: Searching /sw/rhel7/cadence/STRATUS2301 for template
WARNING: BDW_IMPORT_ML_CLOCK_FREQ = 0, using default 5.0.
INFO: Processing template tb.cc
FATAL ERROR: Unable to process template tb.cc
I’m using Matlab version R2024a and Cadence Stratus 23.01, but tested also with 22.01 which gave same error. What are the software versions that this tutorial is verified to work? cadence, stratus, hls MATLAB Answers — New Questions
Error using symengine First argument must not contain functionals.
Dear MathWorks-Community,
I recived the following error message:
Error using symengine
First argument must not contain functionals.
Error in mupadengine/evalin_internal
Error in mupadengine/fevalHelper
Error in mupadengine/feval_internal
Error in sym/diff (line 107)
R = feval_internal(symengine, ‘symobj::diff’, S, x, n);
When I wanted to run my code it appeard for line 10 where I am calculating diffL_over_theta1dot. Can someone please explain me why it worked for diffL_over_alpha1 in line 4 but not for line 10?
L is a symfun.
Can anyone help me with resolving this issue?
Thanks a lot in advance!
syms tau_1
syms theta_1(t) alpha_1(t)
diffL_over_alpha1=diff(L,alpha_1);
alpha_1dot=diff(alpha_1,t);
tau_1==diff(diffL_over_alpha1dot,t)-diff(L,alpha_1dot);
theta_1_dot=diff(theta_1,t);
diffL_over_theta1dot=diff(L,theta_1_dot)
0==diff(diffL_over_theta1dot,t)-diff(L,theta_1);Dear MathWorks-Community,
I recived the following error message:
Error using symengine
First argument must not contain functionals.
Error in mupadengine/evalin_internal
Error in mupadengine/fevalHelper
Error in mupadengine/feval_internal
Error in sym/diff (line 107)
R = feval_internal(symengine, ‘symobj::diff’, S, x, n);
When I wanted to run my code it appeard for line 10 where I am calculating diffL_over_theta1dot. Can someone please explain me why it worked for diffL_over_alpha1 in line 4 but not for line 10?
L is a symfun.
Can anyone help me with resolving this issue?
Thanks a lot in advance!
syms tau_1
syms theta_1(t) alpha_1(t)
diffL_over_alpha1=diff(L,alpha_1);
alpha_1dot=diff(alpha_1,t);
tau_1==diff(diffL_over_alpha1dot,t)-diff(L,alpha_1dot);
theta_1_dot=diff(theta_1,t);
diffL_over_theta1dot=diff(L,theta_1_dot)
0==diff(diffL_over_theta1dot,t)-diff(L,theta_1); Dear MathWorks-Community,
I recived the following error message:
Error using symengine
First argument must not contain functionals.
Error in mupadengine/evalin_internal
Error in mupadengine/fevalHelper
Error in mupadengine/feval_internal
Error in sym/diff (line 107)
R = feval_internal(symengine, ‘symobj::diff’, S, x, n);
When I wanted to run my code it appeard for line 10 where I am calculating diffL_over_theta1dot. Can someone please explain me why it worked for diffL_over_alpha1 in line 4 but not for line 10?
L is a symfun.
Can anyone help me with resolving this issue?
Thanks a lot in advance!
syms tau_1
syms theta_1(t) alpha_1(t)
diffL_over_alpha1=diff(L,alpha_1);
alpha_1dot=diff(alpha_1,t);
tau_1==diff(diffL_over_alpha1dot,t)-diff(L,alpha_1dot);
theta_1_dot=diff(theta_1,t);
diffL_over_theta1dot=diff(L,theta_1_dot)
0==diff(diffL_over_theta1dot,t)-diff(L,theta_1); symbolic MATLAB Answers — New Questions
Simulink model doesn’t oscillate
Hi,
I’m trying to model an reaction wheel inverted pendulum and I find this article: https://www.mdpi.com/2079-9292/13/3/514#B1-electronics-13-00514. And now I have to identify the friction coefficient, b_theta. They mesure the natural oscillation of the pendulum by swinging. And then implement this formula in simulink to estimate b_theta by comparing the results:
On the right is my model and on the left is the model present in the article. The probleme is that my simulation doesn’t oscillate, the result is always 0. And i don’t know what the probleme is. I’m using a fixed step of 1e-3 and the solver is on auto (I try multiple solvers but the result is the same).Hi,
I’m trying to model an reaction wheel inverted pendulum and I find this article: https://www.mdpi.com/2079-9292/13/3/514#B1-electronics-13-00514. And now I have to identify the friction coefficient, b_theta. They mesure the natural oscillation of the pendulum by swinging. And then implement this formula in simulink to estimate b_theta by comparing the results:
On the right is my model and on the left is the model present in the article. The probleme is that my simulation doesn’t oscillate, the result is always 0. And i don’t know what the probleme is. I’m using a fixed step of 1e-3 and the solver is on auto (I try multiple solvers but the result is the same). Hi,
I’m trying to model an reaction wheel inverted pendulum and I find this article: https://www.mdpi.com/2079-9292/13/3/514#B1-electronics-13-00514. And now I have to identify the friction coefficient, b_theta. They mesure the natural oscillation of the pendulum by swinging. And then implement this formula in simulink to estimate b_theta by comparing the results:
On the right is my model and on the left is the model present in the article. The probleme is that my simulation doesn’t oscillate, the result is always 0. And i don’t know what the probleme is. I’m using a fixed step of 1e-3 and the solver is on auto (I try multiple solvers but the result is the same). model MATLAB Answers — New Questions
Dynamic matrix columns combinations
Hello,
I would like to find all possible combinations of a matrix columns, with each column contribute a value, in each itteration of a loop. The matrix size changes in each itteration. For example:
A = [1 2 3
4 5 6
7 8 9].
should produce:
1 2 3
1 2 6
1 5 3 etc.
but should not produce:
1 4 2 for example.
My problems:
When insert the matrix to combvec function nothing happens. The function accept vectors – and since I do it with different matrix size in each Itteration of a loop I can’t write it manually.
ndgrid also requires vectors – and since I need to choose a combination index in other variable – I’m not clear how this happens.
I don’t have combination function in my Matlab version.
Is there a way to define vectors dynamically in a loop? any idea on to how overcome this? Do I need to write a combination function myself?Hello,
I would like to find all possible combinations of a matrix columns, with each column contribute a value, in each itteration of a loop. The matrix size changes in each itteration. For example:
A = [1 2 3
4 5 6
7 8 9].
should produce:
1 2 3
1 2 6
1 5 3 etc.
but should not produce:
1 4 2 for example.
My problems:
When insert the matrix to combvec function nothing happens. The function accept vectors – and since I do it with different matrix size in each Itteration of a loop I can’t write it manually.
ndgrid also requires vectors – and since I need to choose a combination index in other variable – I’m not clear how this happens.
I don’t have combination function in my Matlab version.
Is there a way to define vectors dynamically in a loop? any idea on to how overcome this? Do I need to write a combination function myself? Hello,
I would like to find all possible combinations of a matrix columns, with each column contribute a value, in each itteration of a loop. The matrix size changes in each itteration. For example:
A = [1 2 3
4 5 6
7 8 9].
should produce:
1 2 3
1 2 6
1 5 3 etc.
but should not produce:
1 4 2 for example.
My problems:
When insert the matrix to combvec function nothing happens. The function accept vectors – and since I do it with different matrix size in each Itteration of a loop I can’t write it manually.
ndgrid also requires vectors – and since I need to choose a combination index in other variable – I’m not clear how this happens.
I don’t have combination function in my Matlab version.
Is there a way to define vectors dynamically in a loop? any idea on to how overcome this? Do I need to write a combination function myself? combination MATLAB Answers — New Questions
what toolbox to include for regression
I am running the following code on MATLAB Grader
A=[13 16 19 21 24 26 28]
M=[13 20 23 31 36 42 48]
[r,m,b] =regression(A,M)
It is throwing the following error.
"Undefined function ‘regression’ for input arguments of type ‘double’."
What toolbox I need to include to over come this error?I am running the following code on MATLAB Grader
A=[13 16 19 21 24 26 28]
M=[13 20 23 31 36 42 48]
[r,m,b] =regression(A,M)
It is throwing the following error.
"Undefined function ‘regression’ for input arguments of type ‘double’."
What toolbox I need to include to over come this error? I am running the following code on MATLAB Grader
A=[13 16 19 21 24 26 28]
M=[13 20 23 31 36 42 48]
[r,m,b] =regression(A,M)
It is throwing the following error.
"Undefined function ‘regression’ for input arguments of type ‘double’."
What toolbox I need to include to over come this error? regression MATLAB Answers — New Questions
How to model forced convection in battery cell/pack?
Dear community members,
I would like seek your suggestion on ways to model "forced air convection" in battery cell and battery pack. the natural convection can be modeled using "convective heat transfer" block. liquid cooling can also be modeled using cooling plate blocks, but i am unable to model forced air convection. please reply.
thank you.Dear community members,
I would like seek your suggestion on ways to model "forced air convection" in battery cell and battery pack. the natural convection can be modeled using "convective heat transfer" block. liquid cooling can also be modeled using cooling plate blocks, but i am unable to model forced air convection. please reply.
thank you. Dear community members,
I would like seek your suggestion on ways to model "forced air convection" in battery cell and battery pack. the natural convection can be modeled using "convective heat transfer" block. liquid cooling can also be modeled using cooling plate blocks, but i am unable to model forced air convection. please reply.
thank you. simscape, simulink, battery_system_management, battery cooling MATLAB Answers — New Questions
How to read and extract certain columns from a tenv3 file?
There are two aspects of the problem.
How do I read a tenv3 data file? The source file can be found here.
I wish to extract the data under the 4th, 9th, 11th, and 13th column, such that the first row of the extracted data should read,
" 54847 -1.187879 0.058425 0.879526".
Also can these be stored in the form of an excel file or a txt file?
Please help.There are two aspects of the problem.
How do I read a tenv3 data file? The source file can be found here.
I wish to extract the data under the 4th, 9th, 11th, and 13th column, such that the first row of the extracted data should read,
" 54847 -1.187879 0.058425 0.879526".
Also can these be stored in the form of an excel file or a txt file?
Please help. There are two aspects of the problem.
How do I read a tenv3 data file? The source file can be found here.
I wish to extract the data under the 4th, 9th, 11th, and 13th column, such that the first row of the extracted data should read,
" 54847 -1.187879 0.058425 0.879526".
Also can these be stored in the form of an excel file or a txt file?
Please help. data, data import, text file MATLAB Answers — New Questions
can somebody help me to translate this Arduino code to Matlab?
// DECLARACION DE VARIABLES PARA PINES
const int pinecho = 4;
const int pintrigger = 5;
const int pinled = 13;
// Motor A
int IN1 = 8;
int IN2 = 9;
// Motor B
int IN3 = 6;
int IN4 = 7;
int TIempo=0;
// VARIABLES PARA CALCULOS
unsigned int tiempo, distancia;
void setup() {
// PREPARAR LA COMUNICACION SERIAL
Serial.begin(9600);
// CONFIGURAR PINES DE ENTRADA Y SALIDA
pinMode(pinecho, INPUT); % DUDA
pinMode(pintrigger, OUTPUT);
pinMode(13, OUTPUT);
// inicializar la comunicación serial a 9600 bits por segundo:
Serial.begin(9600);
// Declaramos todos los pines como salidas
pinMode (IN1, OUTPUT);
pinMode (IN2, OUTPUT);
pinMode (IN3, OUTPUT);
pinMode (IN4, OUTPUT);
}
void loop() {
// ENVIAR PULSO DE DISPARO EN EL PIN "TRIGGER"
digitalWrite(pintrigger, LOW);
delayMicroseconds(2);
digitalWrite(pintrigger, HIGH);
// EL PULSO DURA AL MENOS 10 uS EN ESTADO ALTO
delayMicroseconds(2);
digitalWrite(pintrigger, LOW);
// MEDIR EL TIEMPO EN ESTADO ALTO DEL PIN "ECHO" EL PULSO ES PROPORCIONAL A LA DISTANCIA MEDIDA
tiempo = pulseIn(pinecho, HIGH);
// LA VELOCIDAD DEL SONIDO ES DE 340 M/S O 29 MICROSEGUNDOS POR CENTIMETRO
// DIVIDIMOS EL TIEMPO DEL PULSO ENTRE 58, TIEMPO QUE TARDA RECORRER IDA Y VUELTA UN CENTIMETRO LA ONDA SONORA
distancia = tiempo / 58;
// ENVIAR EL RESULTADO AL MONITOR SERIAL
Serial.print(distancia);
Serial.println(" cm");
delay(150);
// ENCENDER EL LED CUANDO SE CUMPLA CON CIERTA DISTANCIA
if (distancia <= 20) {
digitalWrite(13, HIGH);
delay(300);
} else {
digitalWrite(13, LOW);
//apagar el carro
void frenado ();
if (distancia <=20) {
digitalWrite(13, HIGH);
//Direccion motor A
digitalWrite (IN1, LOW);
digitalWrite (IN2, LOW);
//Direccion motor B
digitalWrite (IN3, LOW);
digitalWrite (IN4, LOW);
}
}
if (Serial.available()) {
char dato= Serial.read();
if(dato==’a’)
{
Adelante();
TIempo=0;
}
else if(dato==’r’)
{
Reversa();
TIempo=0;
}
else if(dato==’d’)
{
Derecha();
TIempo=0;
}
else if(dato==’i’)
{
Izquierda();
TIempo=0;
}
}
if(TIempo<1) // 100 cilcos de 1ms
{
TIempo=TIempo+1;
}
else //ya transcurrió 100ms (100ciclos)
{
Parar();
}
delay(1); //pasusa de 1ms por ciclo
}
void Adelante ()
{
//Direccion motor A
digitalWrite (IN1, LOW);
digitalWrite (IN2, HIGH);
//Direccion motor B
digitalWrite (IN3, LOW);
digitalWrite (IN4, HIGH);
}
void Parar ()
{
//Direccion motor A
digitalWrite (IN1, LOW);
digitalWrite (IN2, LOW);
//Direccion motor B
digitalWrite (IN3, LOW);
digitalWrite (IN4, LOW);
}
void Derecha ()
{
//Direccion motor A
digitalWrite (IN1, HIGH);
digitalWrite (IN2, LOW);
//Direccion motor B
digitalWrite (IN3, LOW);
digitalWrite (IN4, HIGH);
}
void Izquierda ()
{
//Direccion motor A
digitalWrite (IN1, LOW);
digitalWrite (IN2, HIGH);
//Direccion motor B
digitalWrite (IN3, HIGH);
digitalWrite (IN4, LOW);
}
void Reversa ()
{
//Direccion motor A
digitalWrite (IN1, HIGH);
digitalWrite (IN2, LOW);
//Direccion motor B
digitalWrite (IN3, HIGH);
digitalWrite (IN4, LOW);
}// DECLARACION DE VARIABLES PARA PINES
const int pinecho = 4;
const int pintrigger = 5;
const int pinled = 13;
// Motor A
int IN1 = 8;
int IN2 = 9;
// Motor B
int IN3 = 6;
int IN4 = 7;
int TIempo=0;
// VARIABLES PARA CALCULOS
unsigned int tiempo, distancia;
void setup() {
// PREPARAR LA COMUNICACION SERIAL
Serial.begin(9600);
// CONFIGURAR PINES DE ENTRADA Y SALIDA
pinMode(pinecho, INPUT); % DUDA
pinMode(pintrigger, OUTPUT);
pinMode(13, OUTPUT);
// inicializar la comunicación serial a 9600 bits por segundo:
Serial.begin(9600);
// Declaramos todos los pines como salidas
pinMode (IN1, OUTPUT);
pinMode (IN2, OUTPUT);
pinMode (IN3, OUTPUT);
pinMode (IN4, OUTPUT);
}
void loop() {
// ENVIAR PULSO DE DISPARO EN EL PIN "TRIGGER"
digitalWrite(pintrigger, LOW);
delayMicroseconds(2);
digitalWrite(pintrigger, HIGH);
// EL PULSO DURA AL MENOS 10 uS EN ESTADO ALTO
delayMicroseconds(2);
digitalWrite(pintrigger, LOW);
// MEDIR EL TIEMPO EN ESTADO ALTO DEL PIN "ECHO" EL PULSO ES PROPORCIONAL A LA DISTANCIA MEDIDA
tiempo = pulseIn(pinecho, HIGH);
// LA VELOCIDAD DEL SONIDO ES DE 340 M/S O 29 MICROSEGUNDOS POR CENTIMETRO
// DIVIDIMOS EL TIEMPO DEL PULSO ENTRE 58, TIEMPO QUE TARDA RECORRER IDA Y VUELTA UN CENTIMETRO LA ONDA SONORA
distancia = tiempo / 58;
// ENVIAR EL RESULTADO AL MONITOR SERIAL
Serial.print(distancia);
Serial.println(" cm");
delay(150);
// ENCENDER EL LED CUANDO SE CUMPLA CON CIERTA DISTANCIA
if (distancia <= 20) {
digitalWrite(13, HIGH);
delay(300);
} else {
digitalWrite(13, LOW);
//apagar el carro
void frenado ();
if (distancia <=20) {
digitalWrite(13, HIGH);
//Direccion motor A
digitalWrite (IN1, LOW);
digitalWrite (IN2, LOW);
//Direccion motor B
digitalWrite (IN3, LOW);
digitalWrite (IN4, LOW);
}
}
if (Serial.available()) {
char dato= Serial.read();
if(dato==’a’)
{
Adelante();
TIempo=0;
}
else if(dato==’r’)
{
Reversa();
TIempo=0;
}
else if(dato==’d’)
{
Derecha();
TIempo=0;
}
else if(dato==’i’)
{
Izquierda();
TIempo=0;
}
}
if(TIempo<1) // 100 cilcos de 1ms
{
TIempo=TIempo+1;
}
else //ya transcurrió 100ms (100ciclos)
{
Parar();
}
delay(1); //pasusa de 1ms por ciclo
}
void Adelante ()
{
//Direccion motor A
digitalWrite (IN1, LOW);
digitalWrite (IN2, HIGH);
//Direccion motor B
digitalWrite (IN3, LOW);
digitalWrite (IN4, HIGH);
}
void Parar ()
{
//Direccion motor A
digitalWrite (IN1, LOW);
digitalWrite (IN2, LOW);
//Direccion motor B
digitalWrite (IN3, LOW);
digitalWrite (IN4, LOW);
}
void Derecha ()
{
//Direccion motor A
digitalWrite (IN1, HIGH);
digitalWrite (IN2, LOW);
//Direccion motor B
digitalWrite (IN3, LOW);
digitalWrite (IN4, HIGH);
}
void Izquierda ()
{
//Direccion motor A
digitalWrite (IN1, LOW);
digitalWrite (IN2, HIGH);
//Direccion motor B
digitalWrite (IN3, HIGH);
digitalWrite (IN4, LOW);
}
void Reversa ()
{
//Direccion motor A
digitalWrite (IN1, HIGH);
digitalWrite (IN2, LOW);
//Direccion motor B
digitalWrite (IN3, HIGH);
digitalWrite (IN4, LOW);
} // DECLARACION DE VARIABLES PARA PINES
const int pinecho = 4;
const int pintrigger = 5;
const int pinled = 13;
// Motor A
int IN1 = 8;
int IN2 = 9;
// Motor B
int IN3 = 6;
int IN4 = 7;
int TIempo=0;
// VARIABLES PARA CALCULOS
unsigned int tiempo, distancia;
void setup() {
// PREPARAR LA COMUNICACION SERIAL
Serial.begin(9600);
// CONFIGURAR PINES DE ENTRADA Y SALIDA
pinMode(pinecho, INPUT); % DUDA
pinMode(pintrigger, OUTPUT);
pinMode(13, OUTPUT);
// inicializar la comunicación serial a 9600 bits por segundo:
Serial.begin(9600);
// Declaramos todos los pines como salidas
pinMode (IN1, OUTPUT);
pinMode (IN2, OUTPUT);
pinMode (IN3, OUTPUT);
pinMode (IN4, OUTPUT);
}
void loop() {
// ENVIAR PULSO DE DISPARO EN EL PIN "TRIGGER"
digitalWrite(pintrigger, LOW);
delayMicroseconds(2);
digitalWrite(pintrigger, HIGH);
// EL PULSO DURA AL MENOS 10 uS EN ESTADO ALTO
delayMicroseconds(2);
digitalWrite(pintrigger, LOW);
// MEDIR EL TIEMPO EN ESTADO ALTO DEL PIN "ECHO" EL PULSO ES PROPORCIONAL A LA DISTANCIA MEDIDA
tiempo = pulseIn(pinecho, HIGH);
// LA VELOCIDAD DEL SONIDO ES DE 340 M/S O 29 MICROSEGUNDOS POR CENTIMETRO
// DIVIDIMOS EL TIEMPO DEL PULSO ENTRE 58, TIEMPO QUE TARDA RECORRER IDA Y VUELTA UN CENTIMETRO LA ONDA SONORA
distancia = tiempo / 58;
// ENVIAR EL RESULTADO AL MONITOR SERIAL
Serial.print(distancia);
Serial.println(" cm");
delay(150);
// ENCENDER EL LED CUANDO SE CUMPLA CON CIERTA DISTANCIA
if (distancia <= 20) {
digitalWrite(13, HIGH);
delay(300);
} else {
digitalWrite(13, LOW);
//apagar el carro
void frenado ();
if (distancia <=20) {
digitalWrite(13, HIGH);
//Direccion motor A
digitalWrite (IN1, LOW);
digitalWrite (IN2, LOW);
//Direccion motor B
digitalWrite (IN3, LOW);
digitalWrite (IN4, LOW);
}
}
if (Serial.available()) {
char dato= Serial.read();
if(dato==’a’)
{
Adelante();
TIempo=0;
}
else if(dato==’r’)
{
Reversa();
TIempo=0;
}
else if(dato==’d’)
{
Derecha();
TIempo=0;
}
else if(dato==’i’)
{
Izquierda();
TIempo=0;
}
}
if(TIempo<1) // 100 cilcos de 1ms
{
TIempo=TIempo+1;
}
else //ya transcurrió 100ms (100ciclos)
{
Parar();
}
delay(1); //pasusa de 1ms por ciclo
}
void Adelante ()
{
//Direccion motor A
digitalWrite (IN1, LOW);
digitalWrite (IN2, HIGH);
//Direccion motor B
digitalWrite (IN3, LOW);
digitalWrite (IN4, HIGH);
}
void Parar ()
{
//Direccion motor A
digitalWrite (IN1, LOW);
digitalWrite (IN2, LOW);
//Direccion motor B
digitalWrite (IN3, LOW);
digitalWrite (IN4, LOW);
}
void Derecha ()
{
//Direccion motor A
digitalWrite (IN1, HIGH);
digitalWrite (IN2, LOW);
//Direccion motor B
digitalWrite (IN3, LOW);
digitalWrite (IN4, HIGH);
}
void Izquierda ()
{
//Direccion motor A
digitalWrite (IN1, LOW);
digitalWrite (IN2, HIGH);
//Direccion motor B
digitalWrite (IN3, HIGH);
digitalWrite (IN4, LOW);
}
void Reversa ()
{
//Direccion motor A
digitalWrite (IN1, HIGH);
digitalWrite (IN2, LOW);
//Direccion motor B
digitalWrite (IN3, HIGH);
digitalWrite (IN4, LOW);
} arduino, matlab MATLAB Answers — New Questions
optimization with two-part value range
Dear MATLAB users and MathWorks support team,
I cannot find a solution to represent an optimization problem in MATLAB in which variables in the objective function can take on a two-part value range. The variable in the objective function should correspond to the thermal output of a heat pump in a central heating system. The variable should be able to assume the values 0 (heat pump off) and all values between 100 and 400 (heat pump on with an output between 100 and 400 kW).
x ∈ {0} ∪ [100, 400]
Do you know of a way to implement this condition? I would very much appreciate an answer or the opportunity to discuss this in more detail.Dear MATLAB users and MathWorks support team,
I cannot find a solution to represent an optimization problem in MATLAB in which variables in the objective function can take on a two-part value range. The variable in the objective function should correspond to the thermal output of a heat pump in a central heating system. The variable should be able to assume the values 0 (heat pump off) and all values between 100 and 400 (heat pump on with an output between 100 and 400 kW).
x ∈ {0} ∪ [100, 400]
Do you know of a way to implement this condition? I would very much appreciate an answer or the opportunity to discuss this in more detail. Dear MATLAB users and MathWorks support team,
I cannot find a solution to represent an optimization problem in MATLAB in which variables in the objective function can take on a two-part value range. The variable in the objective function should correspond to the thermal output of a heat pump in a central heating system. The variable should be able to assume the values 0 (heat pump off) and all values between 100 and 400 (heat pump on with an output between 100 and 400 kW).
x ∈ {0} ∪ [100, 400]
Do you know of a way to implement this condition? I would very much appreciate an answer or the opportunity to discuss this in more detail. optimization, minlp, nonlinear optimization, optimization toolbox MATLAB Answers — New Questions
Running code inspector with a For Loop Iterator
Hello,
I have a model running with a For Iterator (to read an Input Array and write some of its datas to another one shorter array).
The model must go through both Model Advisor and Code Inspector to be embedded in the calculator.
As for the Model Advisor everything is passed and generated code is about 120 lines, however when I try to run the code inspector, it runs for more than 2.5hrs (on the inspection only) and I am forced to kill the Matlab task afterward because it stops running. Here is a screenshot of the model.
Here is what I tried:
include the "add" and the "unitDelaty" inside the referenced model => it creates an algebraic loop
add the triggered block within a referenced model => impossible as it contain an "assignement" block and therefore cannot be referenced.
Simplify the referenced model to reduce load capacity of the model containg.
I can provide the generated C code if necessary
Thank you,Hello,
I have a model running with a For Iterator (to read an Input Array and write some of its datas to another one shorter array).
The model must go through both Model Advisor and Code Inspector to be embedded in the calculator.
As for the Model Advisor everything is passed and generated code is about 120 lines, however when I try to run the code inspector, it runs for more than 2.5hrs (on the inspection only) and I am forced to kill the Matlab task afterward because it stops running. Here is a screenshot of the model.
Here is what I tried:
include the "add" and the "unitDelaty" inside the referenced model => it creates an algebraic loop
add the triggered block within a referenced model => impossible as it contain an "assignement" block and therefore cannot be referenced.
Simplify the referenced model to reduce load capacity of the model containg.
I can provide the generated C code if necessary
Thank you, Hello,
I have a model running with a For Iterator (to read an Input Array and write some of its datas to another one shorter array).
The model must go through both Model Advisor and Code Inspector to be embedded in the calculator.
As for the Model Advisor everything is passed and generated code is about 120 lines, however when I try to run the code inspector, it runs for more than 2.5hrs (on the inspection only) and I am forced to kill the Matlab task afterward because it stops running. Here is a screenshot of the model.
Here is what I tried:
include the "add" and the "unitDelaty" inside the referenced model => it creates an algebraic loop
add the triggered block within a referenced model => impossible as it contain an "assignement" block and therefore cannot be referenced.
Simplify the referenced model to reduce load capacity of the model containg.
I can provide the generated C code if necessary
Thank you, simulink, code generation, code inspector MATLAB Answers — New Questions