Tag Archives: matlab
Why do I get errors about missing “slhostlibcantransmit.dll” or “slhostlibcanreceive.dll” files when running a generated executable using CAN functionality outside MATLAB?
I’ve designed a Simulink model that sends CAN data using a "CAN Transmit" block, or receives data using a "CAN Receive" block from the Vehicle Network Toolbox. I generated an executable from this model using Simulink Coder. Upon running the EXE file, I get the following errors in the console
Could not open library: slhostlibcantransmit.dll.
To run the generated code outside the MATLAB environment, use the packNGo function.
Could not open library: slhostlibcanreceive.dll.
To run the generated code outside the MATLAB environment, use the packNGo function.I’ve designed a Simulink model that sends CAN data using a "CAN Transmit" block, or receives data using a "CAN Receive" block from the Vehicle Network Toolbox. I generated an executable from this model using Simulink Coder. Upon running the EXE file, I get the following errors in the console
Could not open library: slhostlibcantransmit.dll.
To run the generated code outside the MATLAB environment, use the packNGo function.
Could not open library: slhostlibcanreceive.dll.
To run the generated code outside the MATLAB environment, use the packNGo function. I’ve designed a Simulink model that sends CAN data using a "CAN Transmit" block, or receives data using a "CAN Receive" block from the Vehicle Network Toolbox. I generated an executable from this model using Simulink Coder. Upon running the EXE file, I get the following errors in the console
Could not open library: slhostlibcantransmit.dll.
To run the generated code outside the MATLAB environment, use the packNGo function.
Could not open library: slhostlibcanreceive.dll.
To run the generated code outside the MATLAB environment, use the packNGo function. can, packngo, slhostlibcanreceive.dll, executable, vnt MATLAB Answers — New Questions
How to Configure your Minidrone Competition License
How to Configure your Minidrone Competition LicenseHow to Configure your Minidrone Competition License How to Configure your Minidrone Competition License MATLAB Answers — New Questions
How to Configure your Student Competition License for VEX
How to Configure your Student Competition License for VEXHow to Configure your Student Competition License for VEX How to Configure your Student Competition License for VEX MATLAB Answers — New Questions
imshow with a slider object is blocking my Button Down function
I have developed an app that reads all the frames of the video and allows the user to scroll through all the frames of a video with a line that I want to place at the centre of the frame during startup. Subsequently, it will become a user movable line. I initially created a ButtonDown callback on the Axes but it only works on the first image before I use the slider. After that, it doesn’t respond to any clicks.
I then tried a ButtonDown callback on the figure and it doesn’t work on the first image. It only works after I use the slider object and scroll through the frames. Can anyone figure out what the slider is doing to make my callbacks not work throughout the user interaction?
Also, I can’t seem to get rid of the first line that is created by the app during start up. Both callbacks will create a second line when a click is detected but subsequently that second line will be movable while the first line just stays in place.
The last issue I have is that my app takes ages to load when I click the ‘play’ button. At least 30 seconds-1 minute to show the first frame and all the other UI objects in the function. Is there any way I can make my app more efficient?
Here are my codes:
P.S. I use either the UIFigure ButtonDown call back or the UIAxes ButtonDown callback when I run my app and not at the same time.
function play(app, event)
videoReader = VideoReader(‘C:/Capstone/Data/Patient/Left Diaphragm Expiration.mp4’);
app.AllFrames=zeros(app.h,app.w,app.numFrames);
app.h=videoReader.height;
app.w=videoReader.width;
app.numFrames=videoReader.NumFrames;
app.framerate= videoReader.FrameRate;
app.Slider.Limits=[1,app.numFrames];
app.Slider.MinorTicks=[];
firstframe=read(videoReader,1);
for a=1:app.numFrames
frame=read(videoReader,a);
frame=im2gray(frame);
app.AllFrames(:,:,a)=frame;
end
app.framehandle=imshow(firstframe,’Parent’,app.UIAxes);
set(app.framehandle,’HitTest’,’off’);
set(app.framehandle, ‘PickableParts’,’all’);
hold (app.UIAxes,"on");
app.Mline= xline(app.UIAxes,(app.w/2),’Color’,’red’);
app.Mline.LineWidth=2;
function changingValue(app, event)
value = floor(app.Slider.Value);
app.framehandle=imshow(app.AllFrames(:,:,value),[0,255],’Parent’,app.UIAxes)
set(app.framehandle,’HitTest’,’off’);
set(app.framehandle, ‘PickableParts’,’all’);
hold (app.UIAxes,"on");
% Value changed function: Slider
function valueChanged(app, event)
value = floor(app.Slider.Value);
app.framehandle=imshow(app.AllFrames(:,:,value),[0,255],’Parent’,app.UIAxes)
set(app.framehandle,’HitTest’,’off’);
set(app.framehandle, ‘PickableParts’,’all’);
hold (app.UIAxes,"on");
% Button down function: UIFigure
function UIFigureButtonDown(app, event)
delete(app.Mline)
app.Mline=xline(app.UIAxes,app.UIAxes.CurrentPoint(1),’Color’,’red’);
app.Mline.LineWidth=2;
% Button down function: UIAxes
function UIAxesButtonDown(app, event)
app.Mline=xline(app.UIAxes,app.UIAxes.CurrentPoint(1),’Color’,’red’);
app.Mline.LineWidth=2;I have developed an app that reads all the frames of the video and allows the user to scroll through all the frames of a video with a line that I want to place at the centre of the frame during startup. Subsequently, it will become a user movable line. I initially created a ButtonDown callback on the Axes but it only works on the first image before I use the slider. After that, it doesn’t respond to any clicks.
I then tried a ButtonDown callback on the figure and it doesn’t work on the first image. It only works after I use the slider object and scroll through the frames. Can anyone figure out what the slider is doing to make my callbacks not work throughout the user interaction?
Also, I can’t seem to get rid of the first line that is created by the app during start up. Both callbacks will create a second line when a click is detected but subsequently that second line will be movable while the first line just stays in place.
The last issue I have is that my app takes ages to load when I click the ‘play’ button. At least 30 seconds-1 minute to show the first frame and all the other UI objects in the function. Is there any way I can make my app more efficient?
Here are my codes:
P.S. I use either the UIFigure ButtonDown call back or the UIAxes ButtonDown callback when I run my app and not at the same time.
function play(app, event)
videoReader = VideoReader(‘C:/Capstone/Data/Patient/Left Diaphragm Expiration.mp4’);
app.AllFrames=zeros(app.h,app.w,app.numFrames);
app.h=videoReader.height;
app.w=videoReader.width;
app.numFrames=videoReader.NumFrames;
app.framerate= videoReader.FrameRate;
app.Slider.Limits=[1,app.numFrames];
app.Slider.MinorTicks=[];
firstframe=read(videoReader,1);
for a=1:app.numFrames
frame=read(videoReader,a);
frame=im2gray(frame);
app.AllFrames(:,:,a)=frame;
end
app.framehandle=imshow(firstframe,’Parent’,app.UIAxes);
set(app.framehandle,’HitTest’,’off’);
set(app.framehandle, ‘PickableParts’,’all’);
hold (app.UIAxes,"on");
app.Mline= xline(app.UIAxes,(app.w/2),’Color’,’red’);
app.Mline.LineWidth=2;
function changingValue(app, event)
value = floor(app.Slider.Value);
app.framehandle=imshow(app.AllFrames(:,:,value),[0,255],’Parent’,app.UIAxes)
set(app.framehandle,’HitTest’,’off’);
set(app.framehandle, ‘PickableParts’,’all’);
hold (app.UIAxes,"on");
% Value changed function: Slider
function valueChanged(app, event)
value = floor(app.Slider.Value);
app.framehandle=imshow(app.AllFrames(:,:,value),[0,255],’Parent’,app.UIAxes)
set(app.framehandle,’HitTest’,’off’);
set(app.framehandle, ‘PickableParts’,’all’);
hold (app.UIAxes,"on");
% Button down function: UIFigure
function UIFigureButtonDown(app, event)
delete(app.Mline)
app.Mline=xline(app.UIAxes,app.UIAxes.CurrentPoint(1),’Color’,’red’);
app.Mline.LineWidth=2;
% Button down function: UIAxes
function UIAxesButtonDown(app, event)
app.Mline=xline(app.UIAxes,app.UIAxes.CurrentPoint(1),’Color’,’red’);
app.Mline.LineWidth=2; I have developed an app that reads all the frames of the video and allows the user to scroll through all the frames of a video with a line that I want to place at the centre of the frame during startup. Subsequently, it will become a user movable line. I initially created a ButtonDown callback on the Axes but it only works on the first image before I use the slider. After that, it doesn’t respond to any clicks.
I then tried a ButtonDown callback on the figure and it doesn’t work on the first image. It only works after I use the slider object and scroll through the frames. Can anyone figure out what the slider is doing to make my callbacks not work throughout the user interaction?
Also, I can’t seem to get rid of the first line that is created by the app during start up. Both callbacks will create a second line when a click is detected but subsequently that second line will be movable while the first line just stays in place.
The last issue I have is that my app takes ages to load when I click the ‘play’ button. At least 30 seconds-1 minute to show the first frame and all the other UI objects in the function. Is there any way I can make my app more efficient?
Here are my codes:
P.S. I use either the UIFigure ButtonDown call back or the UIAxes ButtonDown callback when I run my app and not at the same time.
function play(app, event)
videoReader = VideoReader(‘C:/Capstone/Data/Patient/Left Diaphragm Expiration.mp4’);
app.AllFrames=zeros(app.h,app.w,app.numFrames);
app.h=videoReader.height;
app.w=videoReader.width;
app.numFrames=videoReader.NumFrames;
app.framerate= videoReader.FrameRate;
app.Slider.Limits=[1,app.numFrames];
app.Slider.MinorTicks=[];
firstframe=read(videoReader,1);
for a=1:app.numFrames
frame=read(videoReader,a);
frame=im2gray(frame);
app.AllFrames(:,:,a)=frame;
end
app.framehandle=imshow(firstframe,’Parent’,app.UIAxes);
set(app.framehandle,’HitTest’,’off’);
set(app.framehandle, ‘PickableParts’,’all’);
hold (app.UIAxes,"on");
app.Mline= xline(app.UIAxes,(app.w/2),’Color’,’red’);
app.Mline.LineWidth=2;
function changingValue(app, event)
value = floor(app.Slider.Value);
app.framehandle=imshow(app.AllFrames(:,:,value),[0,255],’Parent’,app.UIAxes)
set(app.framehandle,’HitTest’,’off’);
set(app.framehandle, ‘PickableParts’,’all’);
hold (app.UIAxes,"on");
% Value changed function: Slider
function valueChanged(app, event)
value = floor(app.Slider.Value);
app.framehandle=imshow(app.AllFrames(:,:,value),[0,255],’Parent’,app.UIAxes)
set(app.framehandle,’HitTest’,’off’);
set(app.framehandle, ‘PickableParts’,’all’);
hold (app.UIAxes,"on");
% Button down function: UIFigure
function UIFigureButtonDown(app, event)
delete(app.Mline)
app.Mline=xline(app.UIAxes,app.UIAxes.CurrentPoint(1),’Color’,’red’);
app.Mline.LineWidth=2;
% Button down function: UIAxes
function UIAxesButtonDown(app, event)
app.Mline=xline(app.UIAxes,app.UIAxes.CurrentPoint(1),’Color’,’red’);
app.Mline.LineWidth=2; appdesigner, image analysis MATLAB Answers — New Questions
LSTM classification for days
I have 20 control and 20 infected samples. The spectral data of both control and infected samples were collected from day1 to day 15 and saved in excel fromat as day1.xlsx, day2.xlsx……..day15.xlsx. For each day the data size is 40*285 (sample*bands). I want to read entire excel data and want to apply LSTM model to classify control and infected samples by considering 15 days as a timepoint. Also I want to know how many days are enough to classify the samples. Any suggestion or related code will be helpful. Thanks!I have 20 control and 20 infected samples. The spectral data of both control and infected samples were collected from day1 to day 15 and saved in excel fromat as day1.xlsx, day2.xlsx……..day15.xlsx. For each day the data size is 40*285 (sample*bands). I want to read entire excel data and want to apply LSTM model to classify control and infected samples by considering 15 days as a timepoint. Also I want to know how many days are enough to classify the samples. Any suggestion or related code will be helpful. Thanks! I have 20 control and 20 infected samples. The spectral data of both control and infected samples were collected from day1 to day 15 and saved in excel fromat as day1.xlsx, day2.xlsx……..day15.xlsx. For each day the data size is 40*285 (sample*bands). I want to read entire excel data and want to apply LSTM model to classify control and infected samples by considering 15 days as a timepoint. Also I want to know how many days are enough to classify the samples. Any suggestion or related code will be helpful. Thanks! lstm, days clssification, sequence classification MATLAB Answers — New Questions
Extract values from ODE45
function [] = Example2()
clc
clear
close all
y0 = [100.; 0; 0]; % Initial values for the dependent variables
tspan= linspace(0,20,50);
options = optimset(‘display’,’off’);
[t,x]= ode45(@ODEfun,tspan,y0,options);
plot(t,x)
legend(‘Fa’,’Fb’,’Fc’)
end
function dYdv = ODEfun(v,s);
Fa = s(1);
Fb = s(2);
Fc = s(3);
Kc = 0.01;
Ft = Fa + Fb + Fc;
Co = 1;
K = 10;
Kb = 40;
ra = 0 – (K * Co / Ft * (Fa – (Co ^ 2 * Fb * Fc ^ 2 / (Kc * Ft ^ 2))));
Ka = 1;
Ra = Ka * Co * Fa / Ft;
Rb = Kb * Co * Fb / Ft;
dFadv = ra – Ra;
dFbdv = 0 – ra – Rb;
dFcdv = -2 * ra;
dYdv = [dFadv; dFbdv; dFcdv];
end
How Do I extract the values of Ra and Rb and plot them ?function [] = Example2()
clc
clear
close all
y0 = [100.; 0; 0]; % Initial values for the dependent variables
tspan= linspace(0,20,50);
options = optimset(‘display’,’off’);
[t,x]= ode45(@ODEfun,tspan,y0,options);
plot(t,x)
legend(‘Fa’,’Fb’,’Fc’)
end
function dYdv = ODEfun(v,s);
Fa = s(1);
Fb = s(2);
Fc = s(3);
Kc = 0.01;
Ft = Fa + Fb + Fc;
Co = 1;
K = 10;
Kb = 40;
ra = 0 – (K * Co / Ft * (Fa – (Co ^ 2 * Fb * Fc ^ 2 / (Kc * Ft ^ 2))));
Ka = 1;
Ra = Ka * Co * Fa / Ft;
Rb = Kb * Co * Fb / Ft;
dFadv = ra – Ra;
dFbdv = 0 – ra – Rb;
dFcdv = -2 * ra;
dYdv = [dFadv; dFbdv; dFcdv];
end
How Do I extract the values of Ra and Rb and plot them ? function [] = Example2()
clc
clear
close all
y0 = [100.; 0; 0]; % Initial values for the dependent variables
tspan= linspace(0,20,50);
options = optimset(‘display’,’off’);
[t,x]= ode45(@ODEfun,tspan,y0,options);
plot(t,x)
legend(‘Fa’,’Fb’,’Fc’)
end
function dYdv = ODEfun(v,s);
Fa = s(1);
Fb = s(2);
Fc = s(3);
Kc = 0.01;
Ft = Fa + Fb + Fc;
Co = 1;
K = 10;
Kb = 40;
ra = 0 – (K * Co / Ft * (Fa – (Co ^ 2 * Fb * Fc ^ 2 / (Kc * Ft ^ 2))));
Ka = 1;
Ra = Ka * Co * Fa / Ft;
Rb = Kb * Co * Fb / Ft;
dFadv = ra – Ra;
dFbdv = 0 – ra – Rb;
dFcdv = -2 * ra;
dYdv = [dFadv; dFbdv; dFcdv];
end
How Do I extract the values of Ra and Rb and plot them ? ode45, outputfcn MATLAB Answers — New Questions
Freewheeling diode causing error in Full-Bridge Inverter model
Hi, please see the attached Simulink model. Its a simple full-bridge inverter producing quasi-square alternating voltage at the load (resistor). The freewheeling diode, although it is standard in the design, is causing some numerical issue during simulation. The error stated is: "Derivative of state ‘full_bridge.Diode.c1.vc’ in block ‘full_bridge/Diode’ at time 0.000255 is not finite. The simulation will be stopped. There may be a singularity in the solution. If not, try reducing the step size (either by reducing the fixed step size or by tightening the error tolerances)".
I suspect the junction capacitance values of the diode is spiking at simulation initiation. Not sure why. Is there any obvious mistake that I am making?Hi, please see the attached Simulink model. Its a simple full-bridge inverter producing quasi-square alternating voltage at the load (resistor). The freewheeling diode, although it is standard in the design, is causing some numerical issue during simulation. The error stated is: "Derivative of state ‘full_bridge.Diode.c1.vc’ in block ‘full_bridge/Diode’ at time 0.000255 is not finite. The simulation will be stopped. There may be a singularity in the solution. If not, try reducing the step size (either by reducing the fixed step size or by tightening the error tolerances)".
I suspect the junction capacitance values of the diode is spiking at simulation initiation. Not sure why. Is there any obvious mistake that I am making? Hi, please see the attached Simulink model. Its a simple full-bridge inverter producing quasi-square alternating voltage at the load (resistor). The freewheeling diode, although it is standard in the design, is causing some numerical issue during simulation. The error stated is: "Derivative of state ‘full_bridge.Diode.c1.vc’ in block ‘full_bridge/Diode’ at time 0.000255 is not finite. The simulation will be stopped. There may be a singularity in the solution. If not, try reducing the step size (either by reducing the fixed step size or by tightening the error tolerances)".
I suspect the junction capacitance values of the diode is spiking at simulation initiation. Not sure why. Is there any obvious mistake that I am making? formulastudent MATLAB Answers — New Questions
How to close Excel-file after writetable()?
I want to use writetable() for an Excel-file in a for-loop. But at the second loop it stops with an error, because the first file is still open and there is no permission. Before I’d open a new folder for the new excel-file, but it doesn’t work in this way now, because the file is still open.I want to use writetable() for an Excel-file in a for-loop. But at the second loop it stops with an error, because the first file is still open and there is no permission. Before I’d open a new folder for the new excel-file, but it doesn’t work in this way now, because the file is still open. I want to use writetable() for an Excel-file in a for-loop. But at the second loop it stops with an error, because the first file is still open and there is no permission. Before I’d open a new folder for the new excel-file, but it doesn’t work in this way now, because the file is still open. excel, close excel, shutdown excel MATLAB Answers — New Questions
Different results of the same caculation by loop code and by array code
for i=1:r
A=A+floor(sqrt(r^2-i^2));
end
—————
i=[1:r];
A=sum(floor(sqrt(r^2-i.^2)));
————————-
The same result by r=10^8
But the different results by r=10^9for i=1:r
A=A+floor(sqrt(r^2-i^2));
end
—————
i=[1:r];
A=sum(floor(sqrt(r^2-i.^2)));
————————-
The same result by r=10^8
But the different results by r=10^9 for i=1:r
A=A+floor(sqrt(r^2-i^2));
end
—————
i=[1:r];
A=sum(floor(sqrt(r^2-i.^2)));
————————-
The same result by r=10^8
But the different results by r=10^9 gaussian circle problem, for loop vs. array MATLAB Answers — New Questions
FSOLVE requires at least two input arguments.
I am trying to run a scipt I from File Exchange, but I am getting error "Error using fsolve (line 186) FSOLVE requires at least two input arguments" Can please help fix the error?
% Prepare the options for the solver
options = prepareOptionsForSolver(options, ‘fsolve’);
end
if nargin == 0
error(message(‘optim:fsolve:NotEnoughInputs’)) (line 186)I am trying to run a scipt I from File Exchange, but I am getting error "Error using fsolve (line 186) FSOLVE requires at least two input arguments" Can please help fix the error?
% Prepare the options for the solver
options = prepareOptionsForSolver(options, ‘fsolve’);
end
if nargin == 0
error(message(‘optim:fsolve:NotEnoughInputs’)) (line 186) I am trying to run a scipt I from File Exchange, but I am getting error "Error using fsolve (line 186) FSOLVE requires at least two input arguments" Can please help fix the error?
% Prepare the options for the solver
options = prepareOptionsForSolver(options, ‘fsolve’);
end
if nargin == 0
error(message(‘optim:fsolve:NotEnoughInputs’)) (line 186) file exchange, solve, error MATLAB Answers — New Questions
“Adding Nominal Values to a Nonlinear MPC Object: Guidance and Steps”
hello everyone,
I have two different objects from two distinct Model Predictive Controllers: one from a linear MPC and the other from a nonlinear MPC. When I created the nonlinear MPC object, there was no column for nominal values in the script, as shown in the second image. Additionally, there is no continuous component in the nonlinear model.
so first question: How can I add a column for nominal values to my nonlinear MPC?
and if not, then I need to restart from the beginning, do you have any suggestions on how to proceed?hello everyone,
I have two different objects from two distinct Model Predictive Controllers: one from a linear MPC and the other from a nonlinear MPC. When I created the nonlinear MPC object, there was no column for nominal values in the script, as shown in the second image. Additionally, there is no continuous component in the nonlinear model.
so first question: How can I add a column for nominal values to my nonlinear MPC?
and if not, then I need to restart from the beginning, do you have any suggestions on how to proceed? hello everyone,
I have two different objects from two distinct Model Predictive Controllers: one from a linear MPC and the other from a nonlinear MPC. When I created the nonlinear MPC object, there was no column for nominal values in the script, as shown in the second image. Additionally, there is no continuous component in the nonlinear model.
so first question: How can I add a column for nominal values to my nonlinear MPC?
and if not, then I need to restart from the beginning, do you have any suggestions on how to proceed? matlab, simulink, model predictive controller, object, nonlinear model predictive controller, nominal values MATLAB Answers — New Questions
Ideas for presenting data vs. two variables,
Hi there!
I currently have a beautiful figure that presents data vs. two variables. I went from using Matlab’s subplot function to using tiledLayout. I have six tiles. To present data vs. two variables, I use the x-axis for one variable, and I use colors for the second variable. For colors, I use a Matlab colormap and customized it a tad, adding a color to the beginning of the spectrum. tiledLayout lets me use a global colorbar, which is great. I have a seventh plot, which is a separate quiver plot to show the associated vector arrows on an object, and I use Adobe Illustrator to merge this seventh plot with the six tiles. If I wanted to present this data in another way, what would be a good way to do it?
A little while back, I made 3D surface plots in Matlab, using the x- and y-axes for the two variables. However, while the surfaces looked super pretty the communication of information wasn’t so great, perhaps. I am revisiting surface plots today, but this time I might choose different variables to use for the x- and y-axes. For 2D plotting, I am using a simplified version of a mathematical model I cooked up. So, each tile has 11 evenly-spaced curves. The curves are simple in shape: think sines and cosines, smooth v-shapes, inverted v-shapes, circles, etc. For instance, one tile might have 11 circles, all positioned differently and sized differently as I sweep through the variables / parameters. Another tile might have 11 sine curves, and these curves might increase or decrease in amplitude, but the frequency appears to be mostly unchanged, and the periodicity appears unchanged.
Thanks in advance,Hi there!
I currently have a beautiful figure that presents data vs. two variables. I went from using Matlab’s subplot function to using tiledLayout. I have six tiles. To present data vs. two variables, I use the x-axis for one variable, and I use colors for the second variable. For colors, I use a Matlab colormap and customized it a tad, adding a color to the beginning of the spectrum. tiledLayout lets me use a global colorbar, which is great. I have a seventh plot, which is a separate quiver plot to show the associated vector arrows on an object, and I use Adobe Illustrator to merge this seventh plot with the six tiles. If I wanted to present this data in another way, what would be a good way to do it?
A little while back, I made 3D surface plots in Matlab, using the x- and y-axes for the two variables. However, while the surfaces looked super pretty the communication of information wasn’t so great, perhaps. I am revisiting surface plots today, but this time I might choose different variables to use for the x- and y-axes. For 2D plotting, I am using a simplified version of a mathematical model I cooked up. So, each tile has 11 evenly-spaced curves. The curves are simple in shape: think sines and cosines, smooth v-shapes, inverted v-shapes, circles, etc. For instance, one tile might have 11 circles, all positioned differently and sized differently as I sweep through the variables / parameters. Another tile might have 11 sine curves, and these curves might increase or decrease in amplitude, but the frequency appears to be mostly unchanged, and the periodicity appears unchanged.
Thanks in advance, Hi there!
I currently have a beautiful figure that presents data vs. two variables. I went from using Matlab’s subplot function to using tiledLayout. I have six tiles. To present data vs. two variables, I use the x-axis for one variable, and I use colors for the second variable. For colors, I use a Matlab colormap and customized it a tad, adding a color to the beginning of the spectrum. tiledLayout lets me use a global colorbar, which is great. I have a seventh plot, which is a separate quiver plot to show the associated vector arrows on an object, and I use Adobe Illustrator to merge this seventh plot with the six tiles. If I wanted to present this data in another way, what would be a good way to do it?
A little while back, I made 3D surface plots in Matlab, using the x- and y-axes for the two variables. However, while the surfaces looked super pretty the communication of information wasn’t so great, perhaps. I am revisiting surface plots today, but this time I might choose different variables to use for the x- and y-axes. For 2D plotting, I am using a simplified version of a mathematical model I cooked up. So, each tile has 11 evenly-spaced curves. The curves are simple in shape: think sines and cosines, smooth v-shapes, inverted v-shapes, circles, etc. For instance, one tile might have 11 circles, all positioned differently and sized differently as I sweep through the variables / parameters. Another tile might have 11 sine curves, and these curves might increase or decrease in amplitude, but the frequency appears to be mostly unchanged, and the periodicity appears unchanged.
Thanks in advance, matlab plot MATLAB Answers — New Questions
Pixhawk 6c : monitor and tune error when using telemtry
I’m currently using matalb2024a and using pixhak6c.
I want to control without using Radio Control, so I planned to use telemetry radio.
When monitor and tune simulation is started using USB (COM11), it works normally, but it does not connect when telemetry (/dev/ty/S5, COM3) is used.
Error: External Mode Open Protocol Connect command fails
Cause:
Could not connect to target application: XCP internal error: timeout expired, in response to XCP CONNECT command
In the Qgroundcontrol parameter setting, MAV_CONFIG_0 was set to disabled.
Is there a solution?I’m currently using matalb2024a and using pixhak6c.
I want to control without using Radio Control, so I planned to use telemetry radio.
When monitor and tune simulation is started using USB (COM11), it works normally, but it does not connect when telemetry (/dev/ty/S5, COM3) is used.
Error: External Mode Open Protocol Connect command fails
Cause:
Could not connect to target application: XCP internal error: timeout expired, in response to XCP CONNECT command
In the Qgroundcontrol parameter setting, MAV_CONFIG_0 was set to disabled.
Is there a solution? I’m currently using matalb2024a and using pixhak6c.
I want to control without using Radio Control, so I planned to use telemetry radio.
When monitor and tune simulation is started using USB (COM11), it works normally, but it does not connect when telemetry (/dev/ty/S5, COM3) is used.
Error: External Mode Open Protocol Connect command fails
Cause:
Could not connect to target application: XCP internal error: timeout expired, in response to XCP CONNECT command
In the Qgroundcontrol parameter setting, MAV_CONFIG_0 was set to disabled.
Is there a solution? pixhawk6c, sik telemetry, monitor and tune MATLAB Answers — New Questions
Firmware Build Failure in hardware setup
Hello all,
Error: /cygdrive/c/PX4/home/Firmware/build/px4_fmu-v6x_multicopter is not a directory
make: *** [Makefile:226: px4_fmu-v6x_multicopter] Error 1
BUILDCOMPLETE_25-Nov-2024_09-38-49
BUILDSTARTING_25-Nov-2024_09-48-00
CMAKE Config selected : px4_fmu-v6x_multicopter
CMake Error at cmake/px4_add_library.cmake:41 (add_library):
Cannot find source file:
monocypher/src/monocypher.c
Tried extensions .c .C .c++ .cc .cpp .cxx .cu .m .M .mm .h .hh .h++ .hm
.hpp .hxx .in .txx
Call Stack (most recent call first):
src/lib/crypto/CMakeLists.txt:34 (px4_add_library)
CMake Error at cmake/px4_add_library.cmake:41 (add_library):
No SOURCES given to target: monocypher
Call Stack (most recent call first):
src/lib/crypto/CMakeLists.txt:34 (px4_add_library)
Error: /cygdrive/c/PX4/home/Firmware/build/px4_fmu-v6x_multicopter is not a directory
make: *** [Makefile:226: px4_fmu-v6x_multicopter] Error 1
BUILDCOMPLETE_25-Nov-2024_09-48-00
I’m encountering this error for a long time eventhough i did remove the cgywin toolchain and reinstalled it using cgywin GUIHello all,
Error: /cygdrive/c/PX4/home/Firmware/build/px4_fmu-v6x_multicopter is not a directory
make: *** [Makefile:226: px4_fmu-v6x_multicopter] Error 1
BUILDCOMPLETE_25-Nov-2024_09-38-49
BUILDSTARTING_25-Nov-2024_09-48-00
CMAKE Config selected : px4_fmu-v6x_multicopter
CMake Error at cmake/px4_add_library.cmake:41 (add_library):
Cannot find source file:
monocypher/src/monocypher.c
Tried extensions .c .C .c++ .cc .cpp .cxx .cu .m .M .mm .h .hh .h++ .hm
.hpp .hxx .in .txx
Call Stack (most recent call first):
src/lib/crypto/CMakeLists.txt:34 (px4_add_library)
CMake Error at cmake/px4_add_library.cmake:41 (add_library):
No SOURCES given to target: monocypher
Call Stack (most recent call first):
src/lib/crypto/CMakeLists.txt:34 (px4_add_library)
Error: /cygdrive/c/PX4/home/Firmware/build/px4_fmu-v6x_multicopter is not a directory
make: *** [Makefile:226: px4_fmu-v6x_multicopter] Error 1
BUILDCOMPLETE_25-Nov-2024_09-48-00
I’m encountering this error for a long time eventhough i did remove the cgywin toolchain and reinstalled it using cgywin GUI Hello all,
Error: /cygdrive/c/PX4/home/Firmware/build/px4_fmu-v6x_multicopter is not a directory
make: *** [Makefile:226: px4_fmu-v6x_multicopter] Error 1
BUILDCOMPLETE_25-Nov-2024_09-38-49
BUILDSTARTING_25-Nov-2024_09-48-00
CMAKE Config selected : px4_fmu-v6x_multicopter
CMake Error at cmake/px4_add_library.cmake:41 (add_library):
Cannot find source file:
monocypher/src/monocypher.c
Tried extensions .c .C .c++ .cc .cpp .cxx .cu .m .M .mm .h .hh .h++ .hm
.hpp .hxx .in .txx
Call Stack (most recent call first):
src/lib/crypto/CMakeLists.txt:34 (px4_add_library)
CMake Error at cmake/px4_add_library.cmake:41 (add_library):
No SOURCES given to target: monocypher
Call Stack (most recent call first):
src/lib/crypto/CMakeLists.txt:34 (px4_add_library)
Error: /cygdrive/c/PX4/home/Firmware/build/px4_fmu-v6x_multicopter is not a directory
make: *** [Makefile:226: px4_fmu-v6x_multicopter] Error 1
BUILDCOMPLETE_25-Nov-2024_09-48-00
I’m encountering this error for a long time eventhough i did remove the cgywin toolchain and reinstalled it using cgywin GUI px4, firware build MATLAB Answers — New Questions
How to define matrices generated in Stateflow as Fixed size?
Hi,
I have had a look around the forum and while there are some similar questions to mine I simply am not understanding where I am going wrong.
Below is my top level design:
with the sub-level looking like this:
the aim for this code is to take two matrices, split them up in to smaller matrices and output complementary slices each time step.
My code works in this sense but trying to use it with further blocks causes this error: "This input port expects a fixed-size mode. The variable-size mode originates from ‘controller/Subsystem/Chart’. Examine the configurations of ‘controller/Subsystem/Matrix Multiply’ for one of the following scenarios: 1) the block does not support variable-size signals; 2) the block supports variable-size signals but needs to be configured for them."
When not setting Slice A or B to variable size I get this error: "’slice_B’ is inferred as a variable-size matrix, but its size is specified as inherited or fixed. Verify ‘slice_B’ is defined in terms of non-tunable parameters, or select the ‘Variable Size’ check box and specify the upper bounds in the Size box."
What can I do to fix this issue? Thanks in advance!Hi,
I have had a look around the forum and while there are some similar questions to mine I simply am not understanding where I am going wrong.
Below is my top level design:
with the sub-level looking like this:
the aim for this code is to take two matrices, split them up in to smaller matrices and output complementary slices each time step.
My code works in this sense but trying to use it with further blocks causes this error: "This input port expects a fixed-size mode. The variable-size mode originates from ‘controller/Subsystem/Chart’. Examine the configurations of ‘controller/Subsystem/Matrix Multiply’ for one of the following scenarios: 1) the block does not support variable-size signals; 2) the block supports variable-size signals but needs to be configured for them."
When not setting Slice A or B to variable size I get this error: "’slice_B’ is inferred as a variable-size matrix, but its size is specified as inherited or fixed. Verify ‘slice_B’ is defined in terms of non-tunable parameters, or select the ‘Variable Size’ check box and specify the upper bounds in the Size box."
What can I do to fix this issue? Thanks in advance! Hi,
I have had a look around the forum and while there are some similar questions to mine I simply am not understanding where I am going wrong.
Below is my top level design:
with the sub-level looking like this:
the aim for this code is to take two matrices, split them up in to smaller matrices and output complementary slices each time step.
My code works in this sense but trying to use it with further blocks causes this error: "This input port expects a fixed-size mode. The variable-size mode originates from ‘controller/Subsystem/Chart’. Examine the configurations of ‘controller/Subsystem/Matrix Multiply’ for one of the following scenarios: 1) the block does not support variable-size signals; 2) the block supports variable-size signals but needs to be configured for them."
When not setting Slice A or B to variable size I get this error: "’slice_B’ is inferred as a variable-size matrix, but its size is specified as inherited or fixed. Verify ‘slice_B’ is defined in terms of non-tunable parameters, or select the ‘Variable Size’ check box and specify the upper bounds in the Size box."
What can I do to fix this issue? Thanks in advance! simulink, stateflow MATLAB Answers — New Questions
mono- objective optimization and multiopjective optimisation, I would like to use GA with option but there is a fault that I can’t to resolve
objective = @(x) 1.002 – ((1 – exp(-0.00003 * x)) ./ (0.00003 * (x + 1.5) + 0.00063 * (1 – exp(-0.00003 * x))));
[a,b]=[24:720];
options = optimoptions(‘ga’, ‘PopulationSize’, 50, ‘MaxGenerations’, 100, ‘Display’, ‘iter’);
[x_opt, fval] = ga(objective, 1, [], [], [], [], a, b, [], options);
disp(‘Résultat optimal :’);
the results are:
??? Undefined function or method ‘optimoptions’ for input arguments of type ‘char’.
Error in ==> obj_1 at 10
options = optimoptions(‘ga’, ‘PopulationSize’, 50, ‘MaxGenerations’, 100, ‘Display’, ‘iter’);objective = @(x) 1.002 – ((1 – exp(-0.00003 * x)) ./ (0.00003 * (x + 1.5) + 0.00063 * (1 – exp(-0.00003 * x))));
[a,b]=[24:720];
options = optimoptions(‘ga’, ‘PopulationSize’, 50, ‘MaxGenerations’, 100, ‘Display’, ‘iter’);
[x_opt, fval] = ga(objective, 1, [], [], [], [], a, b, [], options);
disp(‘Résultat optimal :’);
the results are:
??? Undefined function or method ‘optimoptions’ for input arguments of type ‘char’.
Error in ==> obj_1 at 10
options = optimoptions(‘ga’, ‘PopulationSize’, 50, ‘MaxGenerations’, 100, ‘Display’, ‘iter’); objective = @(x) 1.002 – ((1 – exp(-0.00003 * x)) ./ (0.00003 * (x + 1.5) + 0.00063 * (1 – exp(-0.00003 * x))));
[a,b]=[24:720];
options = optimoptions(‘ga’, ‘PopulationSize’, 50, ‘MaxGenerations’, 100, ‘Display’, ‘iter’);
[x_opt, fval] = ga(objective, 1, [], [], [], [], a, b, [], options);
disp(‘Résultat optimal :’);
the results are:
??? Undefined function or method ‘optimoptions’ for input arguments of type ‘char’.
Error in ==> obj_1 at 10
options = optimoptions(‘ga’, ‘PopulationSize’, 50, ‘MaxGenerations’, 100, ‘Display’, ‘iter’); optimization, genetic algorithm MATLAB Answers — New Questions
Assistance with Missing “Foundational MATLAB” Badge
Dear MathWorks Help Center,
I hope this email finds you well.
I recently completed the MATLAB for the MathWorks Certified MATLAB Associate Exam course. However, I have not yet received the "Foundational MATLAB" badge on Credly, which I believe is awarded upon successful completion of this course.
I kindly request your assistance in resolving this issue and ensuring that the badge is issued. Please let me know if there are any additional steps I need to take to receive it.
Thank you for your time and support. I look forward to your response.
Best regards,
Nguyen Thanh TuanDear MathWorks Help Center,
I hope this email finds you well.
I recently completed the MATLAB for the MathWorks Certified MATLAB Associate Exam course. However, I have not yet received the "Foundational MATLAB" badge on Credly, which I believe is awarded upon successful completion of this course.
I kindly request your assistance in resolving this issue and ensuring that the badge is issued. Please let me know if there are any additional steps I need to take to receive it.
Thank you for your time and support. I look forward to your response.
Best regards,
Nguyen Thanh Tuan Dear MathWorks Help Center,
I hope this email finds you well.
I recently completed the MATLAB for the MathWorks Certified MATLAB Associate Exam course. However, I have not yet received the "Foundational MATLAB" badge on Credly, which I believe is awarded upon successful completion of this course.
I kindly request your assistance in resolving this issue and ensuring that the badge is issued. Please let me know if there are any additional steps I need to take to receive it.
Thank you for your time and support. I look forward to your response.
Best regards,
Nguyen Thanh Tuan matlab badge, foundational matlab, missing badge MATLAB Answers — New Questions
Build error: C++ compiler produced errors.
function deploy_tracing_raspberry_pi() %#codegen
persistent yolov3Detector;
if isempty(yolov3Detector)
yolov3Detector = coder.loadDeepLearningNetwork(‘yolov3Detector.mat’);
end
mypi = raspi(‘192.168.18.233′,’pi’,’raspberry’);
cam = cameraboard(mypi,’Resolution’,’160×120′);
s = servo(mypi, 18, ‘MinPulseDuration’, 1e-3, ‘MaxPulseDuration’, 2e-3);
k = servo(mypi, 23, ‘MinPulseDuration’, 1e-3, ‘MaxPulseDuration’, 2e-3);
n = 90;
m = 90;
u = 2;
t = 0;
writePosition(s, n);
writePosition(k, m);
% Main loop
start = tic;
while t < 10000
t = t + 1;
%Capture image cameraboard
img = snapshot(cam);
elapsedTime = toc(start);
%Process frames at every 0.25 seconds
if elapsedTime > 0.25
end
% Detect
[bboxes,scores] = detect(yolov3Detector,img,’Threshold’,0.6);
if ~isempty(bboxes)
img = insertObjectAnnotation(img,’rectangle’,bboxes,scores);
[hI,wI,~] = size(img);
a = find(scores==max(scores));
x = bboxes(a,1);
y = bboxes(a,2);
w = bboxes(a,3);
h = bboxes(a,4);
if (wI/2 – (x + w/2) < 0)
n=n+u;
if n>=170
n = 150;
writePosition(s,n);
else
writePosition(s,n);
end
end
if (wI/2 – (x + w/2) > 0)
n=n-u;
if n<=10
n = 20;
writePosition(s,n);
else
writePosition(s,n);
end
end
if (hI/2 – (y + h/2) >0)
m=m+u;
if m>=170
m = 150;
writePosition(k,m);
else
writePosition(k,m);
end
end
if (hI/2 – (y + h/2) < 0)
m=m-u;
if m<=10
m = 20;
writePosition(k,m);
else
writePosition(k,m);
end
end
end
displayImage(mypi,img);
drawnow
end
%%
%when running the deploy script, I get an error
%Error executing command "touch -c /home/pi/MATLAB_ws/R2024a/C/Meruzhan/Yolov3/codegen/exe/deploy_tracing_raspberry_pi/*.*;make -j$(($(nproc)+1)) -Otarget -f deploy_tracing_raspberry_pi_rtw.mk all MATLAB_WORKSPACE="/home/pi/MATLAB_ws/R2024a" LINUX_TARGET_LIBS_MACRO="-lSDL -lmmal -lmmal_core -lmmal_util -lmmal_vc_client -lvcos -lbcm_host" -C /home/pi/MATLAB_ws/R2024a/C/Meruzhan/Yolov3/codegen/exe/deploy_tracing_raspberry_pi LC_ALL=C".function deploy_tracing_raspberry_pi() %#codegen
persistent yolov3Detector;
if isempty(yolov3Detector)
yolov3Detector = coder.loadDeepLearningNetwork(‘yolov3Detector.mat’);
end
mypi = raspi(‘192.168.18.233′,’pi’,’raspberry’);
cam = cameraboard(mypi,’Resolution’,’160×120′);
s = servo(mypi, 18, ‘MinPulseDuration’, 1e-3, ‘MaxPulseDuration’, 2e-3);
k = servo(mypi, 23, ‘MinPulseDuration’, 1e-3, ‘MaxPulseDuration’, 2e-3);
n = 90;
m = 90;
u = 2;
t = 0;
writePosition(s, n);
writePosition(k, m);
% Main loop
start = tic;
while t < 10000
t = t + 1;
%Capture image cameraboard
img = snapshot(cam);
elapsedTime = toc(start);
%Process frames at every 0.25 seconds
if elapsedTime > 0.25
end
% Detect
[bboxes,scores] = detect(yolov3Detector,img,’Threshold’,0.6);
if ~isempty(bboxes)
img = insertObjectAnnotation(img,’rectangle’,bboxes,scores);
[hI,wI,~] = size(img);
a = find(scores==max(scores));
x = bboxes(a,1);
y = bboxes(a,2);
w = bboxes(a,3);
h = bboxes(a,4);
if (wI/2 – (x + w/2) < 0)
n=n+u;
if n>=170
n = 150;
writePosition(s,n);
else
writePosition(s,n);
end
end
if (wI/2 – (x + w/2) > 0)
n=n-u;
if n<=10
n = 20;
writePosition(s,n);
else
writePosition(s,n);
end
end
if (hI/2 – (y + h/2) >0)
m=m+u;
if m>=170
m = 150;
writePosition(k,m);
else
writePosition(k,m);
end
end
if (hI/2 – (y + h/2) < 0)
m=m-u;
if m<=10
m = 20;
writePosition(k,m);
else
writePosition(k,m);
end
end
end
displayImage(mypi,img);
drawnow
end
%%
%when running the deploy script, I get an error
%Error executing command "touch -c /home/pi/MATLAB_ws/R2024a/C/Meruzhan/Yolov3/codegen/exe/deploy_tracing_raspberry_pi/*.*;make -j$(($(nproc)+1)) -Otarget -f deploy_tracing_raspberry_pi_rtw.mk all MATLAB_WORKSPACE="/home/pi/MATLAB_ws/R2024a" LINUX_TARGET_LIBS_MACRO="-lSDL -lmmal -lmmal_core -lmmal_util -lmmal_vc_client -lvcos -lbcm_host" -C /home/pi/MATLAB_ws/R2024a/C/Meruzhan/Yolov3/codegen/exe/deploy_tracing_raspberry_pi LC_ALL=C". function deploy_tracing_raspberry_pi() %#codegen
persistent yolov3Detector;
if isempty(yolov3Detector)
yolov3Detector = coder.loadDeepLearningNetwork(‘yolov3Detector.mat’);
end
mypi = raspi(‘192.168.18.233′,’pi’,’raspberry’);
cam = cameraboard(mypi,’Resolution’,’160×120′);
s = servo(mypi, 18, ‘MinPulseDuration’, 1e-3, ‘MaxPulseDuration’, 2e-3);
k = servo(mypi, 23, ‘MinPulseDuration’, 1e-3, ‘MaxPulseDuration’, 2e-3);
n = 90;
m = 90;
u = 2;
t = 0;
writePosition(s, n);
writePosition(k, m);
% Main loop
start = tic;
while t < 10000
t = t + 1;
%Capture image cameraboard
img = snapshot(cam);
elapsedTime = toc(start);
%Process frames at every 0.25 seconds
if elapsedTime > 0.25
end
% Detect
[bboxes,scores] = detect(yolov3Detector,img,’Threshold’,0.6);
if ~isempty(bboxes)
img = insertObjectAnnotation(img,’rectangle’,bboxes,scores);
[hI,wI,~] = size(img);
a = find(scores==max(scores));
x = bboxes(a,1);
y = bboxes(a,2);
w = bboxes(a,3);
h = bboxes(a,4);
if (wI/2 – (x + w/2) < 0)
n=n+u;
if n>=170
n = 150;
writePosition(s,n);
else
writePosition(s,n);
end
end
if (wI/2 – (x + w/2) > 0)
n=n-u;
if n<=10
n = 20;
writePosition(s,n);
else
writePosition(s,n);
end
end
if (hI/2 – (y + h/2) >0)
m=m+u;
if m>=170
m = 150;
writePosition(k,m);
else
writePosition(k,m);
end
end
if (hI/2 – (y + h/2) < 0)
m=m-u;
if m<=10
m = 20;
writePosition(k,m);
else
writePosition(k,m);
end
end
end
displayImage(mypi,img);
drawnow
end
%%
%when running the deploy script, I get an error
%Error executing command "touch -c /home/pi/MATLAB_ws/R2024a/C/Meruzhan/Yolov3/codegen/exe/deploy_tracing_raspberry_pi/*.*;make -j$(($(nproc)+1)) -Otarget -f deploy_tracing_raspberry_pi_rtw.mk all MATLAB_WORKSPACE="/home/pi/MATLAB_ws/R2024a" LINUX_TARGET_LIBS_MACRO="-lSDL -lmmal -lmmal_core -lmmal_util -lmmal_vc_client -lvcos -lbcm_host" -C /home/pi/MATLAB_ws/R2024a/C/Meruzhan/Yolov3/codegen/exe/deploy_tracing_raspberry_pi LC_ALL=C". mcc compiler MATLAB Answers — New Questions
how can i open .lod extension and .iqd extension file in matlab?
lod (Level of Detail) and iqd ( Inphase and Quadrature data)lod (Level of Detail) and iqd ( Inphase and Quadrature data) lod (Level of Detail) and iqd ( Inphase and Quadrature data) radar data MATLAB Answers — New Questions
Battery modeling lead acid constant current charging mode
Hi, I am trying to understand the battery charging mode by using simulink.
A 12V,12Ah lead acid Battery is charged by using the method of constant current. when the battery is fully charge SOC 100%, but why the Terminal voltage is constant at about 24.5V. It’s normal? Could anyone can explain what happened?
Thank you very much. And, I have attached the picture for the lead acid simulink.
I’m new to MatLab and any help or direction would be greatly appreciated.
Sincerely,
Vincent Chye
<</matlabcentral/answers/uploaded_files/43996/battery%20charing.JPG>>
<</matlabcentral/answers/uploaded_files/43995/battery%20charing%201.JPG>>Hi, I am trying to understand the battery charging mode by using simulink.
A 12V,12Ah lead acid Battery is charged by using the method of constant current. when the battery is fully charge SOC 100%, but why the Terminal voltage is constant at about 24.5V. It’s normal? Could anyone can explain what happened?
Thank you very much. And, I have attached the picture for the lead acid simulink.
I’m new to MatLab and any help or direction would be greatly appreciated.
Sincerely,
Vincent Chye
<</matlabcentral/answers/uploaded_files/43996/battery%20charing.JPG>>
<</matlabcentral/answers/uploaded_files/43995/battery%20charing%201.JPG>> Hi, I am trying to understand the battery charging mode by using simulink.
A 12V,12Ah lead acid Battery is charged by using the method of constant current. when the battery is fully charge SOC 100%, but why the Terminal voltage is constant at about 24.5V. It’s normal? Could anyone can explain what happened?
Thank you very much. And, I have attached the picture for the lead acid simulink.
I’m new to MatLab and any help or direction would be greatly appreciated.
Sincerely,
Vincent Chye
<</matlabcentral/answers/uploaded_files/43996/battery%20charing.JPG>>
<</matlabcentral/answers/uploaded_files/43995/battery%20charing%201.JPG>> lead acid battery, power_electronics_control, battery_system_management MATLAB Answers — New Questions