Tag Archives: matlab
Using VHDL package files in Simulink
I would like to use a VHDL package file in my simulink model. I would like to read the variables from the VHDL package file and not import the constants to the workspace
Is there a way to use the constants established in the package file easily? Or should I just read them into the workspace?
I would like to avoid using the workspace if possible.I would like to use a VHDL package file in my simulink model. I would like to read the variables from the VHDL package file and not import the constants to the workspace
Is there a way to use the constants established in the package file easily? Or should I just read them into the workspace?
I would like to avoid using the workspace if possible. I would like to use a VHDL package file in my simulink model. I would like to read the variables from the VHDL package file and not import the constants to the workspace
Is there a way to use the constants established in the package file easily? Or should I just read them into the workspace?
I would like to avoid using the workspace if possible. hdl, vhdl, cosimulation, simulink MATLAB Answers — New Questions
Index exceeds the number of array elements. Index must not exceed 1.
Hello,
I’ve used " s=tf(‘s’) " in multiple scripts with no problem, but now I’m getting this error. The same thing is happening in older scripts that worked in the past. Did I accidentally turn some Toolbox off? How can I troubleshoot that? Thank youHello,
I’ve used " s=tf(‘s’) " in multiple scripts with no problem, but now I’m getting this error. The same thing is happening in older scripts that worked in the past. Did I accidentally turn some Toolbox off? How can I troubleshoot that? Thank you Hello,
I’ve used " s=tf(‘s’) " in multiple scripts with no problem, but now I’m getting this error. The same thing is happening in older scripts that worked in the past. Did I accidentally turn some Toolbox off? How can I troubleshoot that? Thank you tf MATLAB Answers — New Questions
A saved GAN trained model for image generation does not generate the same accurate images when GPU is reset
When I train the flower image generation example, everything seems to go well as long as the GPU memory keeps the parameters loaded. I obtain images of easily recognizable flowers, as shown in the example. However, if I save the complete training workspace using the ‘save’ command (for example, save(‘GANWorkspacefile.mat’)), which also includes netG, then clear the GPU memory (reset), and subsequently load the previous workspace (load(‘GANWorkspacefile.mat’)), the images generated with ‘predict’ end up blurry—no flowers at all—resembling the ones generated at the beginning of training. The same issue occurs when I transfer the saved workspace and load it on another machine with the same version of MATLAB (R2022b). It seems that something is missing when loading the workspace variables that prevents generating the images in the same way as they are generated just at the end of training. I would appreciate it if someone has any idea of what I’m doing wrong could comment on it.
Thank you.When I train the flower image generation example, everything seems to go well as long as the GPU memory keeps the parameters loaded. I obtain images of easily recognizable flowers, as shown in the example. However, if I save the complete training workspace using the ‘save’ command (for example, save(‘GANWorkspacefile.mat’)), which also includes netG, then clear the GPU memory (reset), and subsequently load the previous workspace (load(‘GANWorkspacefile.mat’)), the images generated with ‘predict’ end up blurry—no flowers at all—resembling the ones generated at the beginning of training. The same issue occurs when I transfer the saved workspace and load it on another machine with the same version of MATLAB (R2022b). It seems that something is missing when loading the workspace variables that prevents generating the images in the same way as they are generated just at the end of training. I would appreciate it if someone has any idea of what I’m doing wrong could comment on it.
Thank you. When I train the flower image generation example, everything seems to go well as long as the GPU memory keeps the parameters loaded. I obtain images of easily recognizable flowers, as shown in the example. However, if I save the complete training workspace using the ‘save’ command (for example, save(‘GANWorkspacefile.mat’)), which also includes netG, then clear the GPU memory (reset), and subsequently load the previous workspace (load(‘GANWorkspacefile.mat’)), the images generated with ‘predict’ end up blurry—no flowers at all—resembling the ones generated at the beginning of training. The same issue occurs when I transfer the saved workspace and load it on another machine with the same version of MATLAB (R2022b). It seems that something is missing when loading the workspace variables that prevents generating the images in the same way as they are generated just at the end of training. I would appreciate it if someone has any idea of what I’m doing wrong could comment on it.
Thank you. deep learning, gan, matlab MATLAB Answers — New Questions
Can I limit the Simulink Library Browser to only show those blocks that my current license supports?
I have most of the tooboxes and blocksets installed. I use different license files based on projects/programs. When I search for blocks, I end up with a large returns, most of which are not licensed. I am spending way to much time trying to sort and search to get useable (licensed) blocks. How do I trim down the search space and library view without uninstalling/reinstalling toolboxes?I have most of the tooboxes and blocksets installed. I use different license files based on projects/programs. When I search for blocks, I end up with a large returns, most of which are not licensed. I am spending way to much time trying to sort and search to get useable (licensed) blocks. How do I trim down the search space and library view without uninstalling/reinstalling toolboxes? I have most of the tooboxes and blocksets installed. I use different license files based on projects/programs. When I search for blocks, I end up with a large returns, most of which are not licensed. I am spending way to much time trying to sort and search to get useable (licensed) blocks. How do I trim down the search space and library view without uninstalling/reinstalling toolboxes? simulink library browser, license, view MATLAB Answers — New Questions
Import FMU in simulink FMU block simulation error
I imported FMU in simulink FMU block , but getting this error while simulating it
Block ‘untitled/FMU’ is configured to require a nonvirtual bus or non-bus signal, however the type of the input signal to the block is virtual. Please see Simulink documentation for further information on composite (i.e. bus) signals and their proper usage. Alternately, if the input bus signal consists only of scalar elements, 1-D elements, or either row or column vectors; and all elements have the same data type, signal type, and sampling mode, consider inserting a Bus to Vector conversion block in the signal path.I imported FMU in simulink FMU block , but getting this error while simulating it
Block ‘untitled/FMU’ is configured to require a nonvirtual bus or non-bus signal, however the type of the input signal to the block is virtual. Please see Simulink documentation for further information on composite (i.e. bus) signals and their proper usage. Alternately, if the input bus signal consists only of scalar elements, 1-D elements, or either row or column vectors; and all elements have the same data type, signal type, and sampling mode, consider inserting a Bus to Vector conversion block in the signal path. I imported FMU in simulink FMU block , but getting this error while simulating it
Block ‘untitled/FMU’ is configured to require a nonvirtual bus or non-bus signal, however the type of the input signal to the block is virtual. Please see Simulink documentation for further information on composite (i.e. bus) signals and their proper usage. Alternately, if the input bus signal consists only of scalar elements, 1-D elements, or either row or column vectors; and all elements have the same data type, signal type, and sampling mode, consider inserting a Bus to Vector conversion block in the signal path. simulink fmu import error MATLAB Answers — New Questions
Can function [s,h] = silhouette(X, clust, distance, varargin) be run using parfor (parallel computation)?
function [s,h] = silhouette(X, clust, distance, varargin)
X is in the order of 10^5, and it’s taking too long time to compute for all data points. How can I accelerate using parallel computation?function [s,h] = silhouette(X, clust, distance, varargin)
X is in the order of 10^5, and it’s taking too long time to compute for all data points. How can I accelerate using parallel computation? function [s,h] = silhouette(X, clust, distance, varargin)
X is in the order of 10^5, and it’s taking too long time to compute for all data points. How can I accelerate using parallel computation? silhoutte, parfor MATLAB Answers — New Questions
Testing private functions in classes
I’m wondering what the best way is to write unit tests for private functions and properties in classes. Say for example, I have a class that represents a ball launched as a projectile:
class ball
%
properties (Access = private)
initialSpeed = 25; %m/s
acceleration = -10; %m/s^2
end
%
methods
function distTravelled = getDistanceTravelled(obj, timeElapsed)
% Estimate total distance traveled by the ball
% (I know this is a bad approximation)
currSpeed = obj.getCurrSpeed(timeElapsed);
distTravelled = 0.5 * (obj.initialSpeed + currSpeed) * timeElapsed;
end
end
%
methods (Access = private)
function currSpeed = getCurrSpeed(obj, timeElapsed)
%Calculate current speed of ball
currSpeed = obj.initialSpeed + obj.acceleration * timeElapsed;
end
end
end
How should I write a test to check that the values for acceleration or that the value returned by the method getCurrSpeed is accurate? Should I just allow access to the testing functions?I’m wondering what the best way is to write unit tests for private functions and properties in classes. Say for example, I have a class that represents a ball launched as a projectile:
class ball
%
properties (Access = private)
initialSpeed = 25; %m/s
acceleration = -10; %m/s^2
end
%
methods
function distTravelled = getDistanceTravelled(obj, timeElapsed)
% Estimate total distance traveled by the ball
% (I know this is a bad approximation)
currSpeed = obj.getCurrSpeed(timeElapsed);
distTravelled = 0.5 * (obj.initialSpeed + currSpeed) * timeElapsed;
end
end
%
methods (Access = private)
function currSpeed = getCurrSpeed(obj, timeElapsed)
%Calculate current speed of ball
currSpeed = obj.initialSpeed + obj.acceleration * timeElapsed;
end
end
end
How should I write a test to check that the values for acceleration or that the value returned by the method getCurrSpeed is accurate? Should I just allow access to the testing functions? I’m wondering what the best way is to write unit tests for private functions and properties in classes. Say for example, I have a class that represents a ball launched as a projectile:
class ball
%
properties (Access = private)
initialSpeed = 25; %m/s
acceleration = -10; %m/s^2
end
%
methods
function distTravelled = getDistanceTravelled(obj, timeElapsed)
% Estimate total distance traveled by the ball
% (I know this is a bad approximation)
currSpeed = obj.getCurrSpeed(timeElapsed);
distTravelled = 0.5 * (obj.initialSpeed + currSpeed) * timeElapsed;
end
end
%
methods (Access = private)
function currSpeed = getCurrSpeed(obj, timeElapsed)
%Calculate current speed of ball
currSpeed = obj.initialSpeed + obj.acceleration * timeElapsed;
end
end
end
How should I write a test to check that the values for acceleration or that the value returned by the method getCurrSpeed is accurate? Should I just allow access to the testing functions? unit tests, object-oriented progamming, oop MATLAB Answers — New Questions
How can I connect CANopen with MATLAB?
Hello everyone,
I am trying to build a GUI with MATLAB for a machine which uses CANopen as a fieldbus system. I would like to know how could I connect CANopen with MATLAB?
Would be great if someone can help meHello everyone,
I am trying to build a GUI with MATLAB for a machine which uses CANopen as a fieldbus system. I would like to know how could I connect CANopen with MATLAB?
Would be great if someone can help me Hello everyone,
I am trying to build a GUI with MATLAB for a machine which uses CANopen as a fieldbus system. I would like to know how could I connect CANopen with MATLAB?
Would be great if someone can help me canopen, matlab gui, connect, matlab, fieldbus MATLAB Answers — New Questions
Using STM32CubeMX and Creating Global Init Functions
I have been intermittently attempting to use a Arduino Giga R1 with Simulink. I have, to my knowledge setup a simple example within a STM32 ioc file (derived from this setup: https://github.com/szabo-tamas/GigaR1Init). However in the building process within Simulink, it fails due to init functions needing to be set to global functions. I have followed all steps within the stm32cubemx guide on mathworks. Current information about how to set up in stm32cubemx: https://www.mathworks.com/help/supportpkg/stmicroelectronicsstm32f4discovery/ug/Getting-started-stm32cubemx.html.
Are there any guides on how to accomplish this appropriately or correctly within matlab/simulink environment, instead of what was recommended within the STM32 community here: https://community.st.com/t5/stm32cubemx-mcus/how-to-change-init-functions-to-global/td-p/53187. I drafted a simple function to update the init function-calls to be externs, not saying it couldnt be optimized, or improved (see attached). I believe this should enable building the simple example, however I still receive the same error when attempting to build code.
Current error when I attempt to build:
Every init function must be configured to generate a global function call instead of static functions call in STM32CubeMX project.I have been intermittently attempting to use a Arduino Giga R1 with Simulink. I have, to my knowledge setup a simple example within a STM32 ioc file (derived from this setup: https://github.com/szabo-tamas/GigaR1Init). However in the building process within Simulink, it fails due to init functions needing to be set to global functions. I have followed all steps within the stm32cubemx guide on mathworks. Current information about how to set up in stm32cubemx: https://www.mathworks.com/help/supportpkg/stmicroelectronicsstm32f4discovery/ug/Getting-started-stm32cubemx.html.
Are there any guides on how to accomplish this appropriately or correctly within matlab/simulink environment, instead of what was recommended within the STM32 community here: https://community.st.com/t5/stm32cubemx-mcus/how-to-change-init-functions-to-global/td-p/53187. I drafted a simple function to update the init function-calls to be externs, not saying it couldnt be optimized, or improved (see attached). I believe this should enable building the simple example, however I still receive the same error when attempting to build code.
Current error when I attempt to build:
Every init function must be configured to generate a global function call instead of static functions call in STM32CubeMX project. I have been intermittently attempting to use a Arduino Giga R1 with Simulink. I have, to my knowledge setup a simple example within a STM32 ioc file (derived from this setup: https://github.com/szabo-tamas/GigaR1Init). However in the building process within Simulink, it fails due to init functions needing to be set to global functions. I have followed all steps within the stm32cubemx guide on mathworks. Current information about how to set up in stm32cubemx: https://www.mathworks.com/help/supportpkg/stmicroelectronicsstm32f4discovery/ug/Getting-started-stm32cubemx.html.
Are there any guides on how to accomplish this appropriately or correctly within matlab/simulink environment, instead of what was recommended within the STM32 community here: https://community.st.com/t5/stm32cubemx-mcus/how-to-change-init-functions-to-global/td-p/53187. I drafted a simple function to update the init function-calls to be externs, not saying it couldnt be optimized, or improved (see attached). I believe this should enable building the simple example, however I still receive the same error when attempting to build code.
Current error when I attempt to build:
Every init function must be configured to generate a global function call instead of static functions call in STM32CubeMX project. arduino, giga r1, stm32, stm32cubemx MATLAB Answers — New Questions
Create contour plot from scatter plot
I want to create a contour from this matrix with x,y and z data. x is the length, y is the width and z is the deviatoric strain.
I want to create a contour plot instead. Is that possible?
figure; hold on ; box on
scatter(x,y,[20],-z,’filled’)
ylabel(‘Width, $(mathrm{m})$’,’FontSize’,15); xlabel(‘Length, $(mathrm{m})$’,’FontSize’,15,’FontName’,’times’)I want to create a contour from this matrix with x,y and z data. x is the length, y is the width and z is the deviatoric strain.
I want to create a contour plot instead. Is that possible?
figure; hold on ; box on
scatter(x,y,[20],-z,’filled’)
ylabel(‘Width, $(mathrm{m})$’,’FontSize’,15); xlabel(‘Length, $(mathrm{m})$’,’FontSize’,15,’FontName’,’times’) I want to create a contour from this matrix with x,y and z data. x is the length, y is the width and z is the deviatoric strain.
I want to create a contour plot instead. Is that possible?
figure; hold on ; box on
scatter(x,y,[20],-z,’filled’)
ylabel(‘Width, $(mathrm{m})$’,’FontSize’,15); xlabel(‘Length, $(mathrm{m})$’,’FontSize’,15,’FontName’,’times’) contour plot MATLAB Answers — New Questions
One legend for a group of subtightplots
In the following plot, formed by 4 subtightplots, how can I have just one (outside) legend for the left plots, and just one right (outside) legend for the right plots?
addpath(‘/…/subtightplot’);
subplot = @(m,n,p) subtightplot (m, n, p, [0.03 0], [0.04 0.03], [0.06 0.06]);
figure(‘position’,[700 100 1200 1200],’Color’,[1 1 1]);
hold on
for i = 1 : 4
subplot(2,2,i);
if i == 1 || i == 3 %%% left plots
hold on
t = 0:1:10;
plot(t,20.*cos(t),’^–‘,’LineWidth’,1,’Color’,’b’)
plot(1:10,(1:10).^2,’^–‘,’LineWidth’,1,’Color’,’k’)
plot(1:10,(1:10).^2.3,’^–‘,’LineWidth’,1,’Color’,’g’)
hold off
else %%% right plots
hold on
plot(1:10,randi([-50,50],10,1),’o-‘,’LineWidth’,1,’Color’,’r’)
plot(1:10,randi([-50,50],10,1),’o-‘,’LineWidth’,1,’Color’,’m’)
plot(1:10,randi([-50,50],10,1),’o-‘,’LineWidth’,1,’Color’,’y’)
hold off
end
legend(‘Box’,’off’);
end
hold off
This is the my desired result:In the following plot, formed by 4 subtightplots, how can I have just one (outside) legend for the left plots, and just one right (outside) legend for the right plots?
addpath(‘/…/subtightplot’);
subplot = @(m,n,p) subtightplot (m, n, p, [0.03 0], [0.04 0.03], [0.06 0.06]);
figure(‘position’,[700 100 1200 1200],’Color’,[1 1 1]);
hold on
for i = 1 : 4
subplot(2,2,i);
if i == 1 || i == 3 %%% left plots
hold on
t = 0:1:10;
plot(t,20.*cos(t),’^–‘,’LineWidth’,1,’Color’,’b’)
plot(1:10,(1:10).^2,’^–‘,’LineWidth’,1,’Color’,’k’)
plot(1:10,(1:10).^2.3,’^–‘,’LineWidth’,1,’Color’,’g’)
hold off
else %%% right plots
hold on
plot(1:10,randi([-50,50],10,1),’o-‘,’LineWidth’,1,’Color’,’r’)
plot(1:10,randi([-50,50],10,1),’o-‘,’LineWidth’,1,’Color’,’m’)
plot(1:10,randi([-50,50],10,1),’o-‘,’LineWidth’,1,’Color’,’y’)
hold off
end
legend(‘Box’,’off’);
end
hold off
This is the my desired result: In the following plot, formed by 4 subtightplots, how can I have just one (outside) legend for the left plots, and just one right (outside) legend for the right plots?
addpath(‘/…/subtightplot’);
subplot = @(m,n,p) subtightplot (m, n, p, [0.03 0], [0.04 0.03], [0.06 0.06]);
figure(‘position’,[700 100 1200 1200],’Color’,[1 1 1]);
hold on
for i = 1 : 4
subplot(2,2,i);
if i == 1 || i == 3 %%% left plots
hold on
t = 0:1:10;
plot(t,20.*cos(t),’^–‘,’LineWidth’,1,’Color’,’b’)
plot(1:10,(1:10).^2,’^–‘,’LineWidth’,1,’Color’,’k’)
plot(1:10,(1:10).^2.3,’^–‘,’LineWidth’,1,’Color’,’g’)
hold off
else %%% right plots
hold on
plot(1:10,randi([-50,50],10,1),’o-‘,’LineWidth’,1,’Color’,’r’)
plot(1:10,randi([-50,50],10,1),’o-‘,’LineWidth’,1,’Color’,’m’)
plot(1:10,randi([-50,50],10,1),’o-‘,’LineWidth’,1,’Color’,’y’)
hold off
end
legend(‘Box’,’off’);
end
hold off
This is the my desired result: legend, subtightplot MATLAB Answers — New Questions
How can I write a set of first order ODEs with two variables?
Hi, my assignment asks me to convert the following two 2nd order ODE’s to a system of four 1st order ODEs and then encode the equations in a function to then use with ODE45.
The two 2nd order ODE’s are as follows:
Then I converted them to a system of four 1st order ODEs (I think I did this correctly):
y’ = v
x’ = u
u’ = -(D/m)*u*sqrt(u^2+v^2)
v’ = -g-(D/m)*v*sqrt(u^2+v^2)
Then, I’ve been looking at this page as a reference for writing the system in my code. But, I’m confused as to how to write it when there are two different equations that use both x and y. The problem does say to slit the equations into several first order ODE’s in terms of the values of y. Thank you!!Hi, my assignment asks me to convert the following two 2nd order ODE’s to a system of four 1st order ODEs and then encode the equations in a function to then use with ODE45.
The two 2nd order ODE’s are as follows:
Then I converted them to a system of four 1st order ODEs (I think I did this correctly):
y’ = v
x’ = u
u’ = -(D/m)*u*sqrt(u^2+v^2)
v’ = -g-(D/m)*v*sqrt(u^2+v^2)
Then, I’ve been looking at this page as a reference for writing the system in my code. But, I’m confused as to how to write it when there are two different equations that use both x and y. The problem does say to slit the equations into several first order ODE’s in terms of the values of y. Thank you!! Hi, my assignment asks me to convert the following two 2nd order ODE’s to a system of four 1st order ODEs and then encode the equations in a function to then use with ODE45.
The two 2nd order ODE’s are as follows:
Then I converted them to a system of four 1st order ODEs (I think I did this correctly):
y’ = v
x’ = u
u’ = -(D/m)*u*sqrt(u^2+v^2)
v’ = -g-(D/m)*v*sqrt(u^2+v^2)
Then, I’ve been looking at this page as a reference for writing the system in my code. But, I’m confused as to how to write it when there are two different equations that use both x and y. The problem does say to slit the equations into several first order ODE’s in terms of the values of y. Thank you!! ode, ode45 MATLAB Answers — New Questions
Field Value Guage widgets are blank
I have a set of plots and guages set up using the widgets. Last year they all worked. Now the plots work fine but the Field Guage Widgets are blank. I can create a Numeric Display widget and that works. But if I create a new Field Guage Widget (dial) it is blank. I get the outline of the display window but nothing shows up inside the window. Are guages still supported?I have a set of plots and guages set up using the widgets. Last year they all worked. Now the plots work fine but the Field Guage Widgets are blank. I can create a Numeric Display widget and that works. But if I create a new Field Guage Widget (dial) it is blank. I get the outline of the display window but nothing shows up inside the window. Are guages still supported? I have a set of plots and guages set up using the widgets. Last year they all worked. Now the plots work fine but the Field Guage Widgets are blank. I can create a Numeric Display widget and that works. But if I create a new Field Guage Widget (dial) it is blank. I get the outline of the display window but nothing shows up inside the window. Are guages still supported? guage, widget MATLAB Answers — New Questions
How to setup gamultiobj to “explore farther” along a specific objective?
Overview: This question deals with a scenario where one of the objectives is "more important" than another, and we want the Pareto front to "mostly minimize" the important objective and have a large variability along the unimportant one.
Background: I am dealing with an optimization problem that consists of one "important" objective, and another "unimportant" one. Initially, it started out as single-objective optimization, but it produced results that "didn’t make sense". In response, I’ve introduced a second objective, so as to keep the first one in check. However, I’m mainly interested in solutions that minimize the original objective. To put this graphically, let’s say that this is the current output:
where Objective 1 is the important objective and Objective 2 is the unimportant one. I’m more interested in the vertical region (where Obj1 is minimized) at the expense of the horizontal region. In other words, I’m interested in what is happening for Obj2 < 16.6, but instead I’m seeing Obj2>17, which I don’t really care about.
I have a feeling that the optimization options can somehow help in getting the desired result, though playing around with various settings of optimopts(@gamultiobj, …) (such as ParetoFraction and DistanceMeasureFcn), I couldn’t get it to work.
My question is: How to set up the multi-objective GA optimization problem, such that more of the pareto is explored in a specific direction (while sacrificing the resolution and/or the distance along the other direction)? Alternatively, how to have more of the pareto explored in both directions (while sacrificing the resolution).
P.S.
I am aware of the possibility of defining a single objective that is a weighted sum of the present objectives, which would turn this into a question of choosing an appropriate weighting. However, this would be a last resort for me, so I would rather keep it as a multiple-objective problem.
P.S. 2
I am sure that solutions exist in the desired (unexplored) region.Overview: This question deals with a scenario where one of the objectives is "more important" than another, and we want the Pareto front to "mostly minimize" the important objective and have a large variability along the unimportant one.
Background: I am dealing with an optimization problem that consists of one "important" objective, and another "unimportant" one. Initially, it started out as single-objective optimization, but it produced results that "didn’t make sense". In response, I’ve introduced a second objective, so as to keep the first one in check. However, I’m mainly interested in solutions that minimize the original objective. To put this graphically, let’s say that this is the current output:
where Objective 1 is the important objective and Objective 2 is the unimportant one. I’m more interested in the vertical region (where Obj1 is minimized) at the expense of the horizontal region. In other words, I’m interested in what is happening for Obj2 < 16.6, but instead I’m seeing Obj2>17, which I don’t really care about.
I have a feeling that the optimization options can somehow help in getting the desired result, though playing around with various settings of optimopts(@gamultiobj, …) (such as ParetoFraction and DistanceMeasureFcn), I couldn’t get it to work.
My question is: How to set up the multi-objective GA optimization problem, such that more of the pareto is explored in a specific direction (while sacrificing the resolution and/or the distance along the other direction)? Alternatively, how to have more of the pareto explored in both directions (while sacrificing the resolution).
P.S.
I am aware of the possibility of defining a single objective that is a weighted sum of the present objectives, which would turn this into a question of choosing an appropriate weighting. However, this would be a last resort for me, so I would rather keep it as a multiple-objective problem.
P.S. 2
I am sure that solutions exist in the desired (unexplored) region. Overview: This question deals with a scenario where one of the objectives is "more important" than another, and we want the Pareto front to "mostly minimize" the important objective and have a large variability along the unimportant one.
Background: I am dealing with an optimization problem that consists of one "important" objective, and another "unimportant" one. Initially, it started out as single-objective optimization, but it produced results that "didn’t make sense". In response, I’ve introduced a second objective, so as to keep the first one in check. However, I’m mainly interested in solutions that minimize the original objective. To put this graphically, let’s say that this is the current output:
where Objective 1 is the important objective and Objective 2 is the unimportant one. I’m more interested in the vertical region (where Obj1 is minimized) at the expense of the horizontal region. In other words, I’m interested in what is happening for Obj2 < 16.6, but instead I’m seeing Obj2>17, which I don’t really care about.
I have a feeling that the optimization options can somehow help in getting the desired result, though playing around with various settings of optimopts(@gamultiobj, …) (such as ParetoFraction and DistanceMeasureFcn), I couldn’t get it to work.
My question is: How to set up the multi-objective GA optimization problem, such that more of the pareto is explored in a specific direction (while sacrificing the resolution and/or the distance along the other direction)? Alternatively, how to have more of the pareto explored in both directions (while sacrificing the resolution).
P.S.
I am aware of the possibility of defining a single objective that is a weighted sum of the present objectives, which would turn this into a question of choosing an appropriate weighting. However, this would be a last resort for me, so I would rather keep it as a multiple-objective problem.
P.S. 2
I am sure that solutions exist in the desired (unexplored) region. ga, gamultiobj, pareto-front MATLAB Answers — New Questions
how to fix these code lines for app designer
e gaussian and periodic noise this is my code for them and they didnt work how can i fix them plz?
this is the gaussina noise code
a=(app.Image);
noise=imnoise(a,’gaussian’);
I=imshow(noise,’parent’,app.UIAxes2,…
‘XData’,[1 app.UIAxes2.Position(3)],…
‘YData’,[1 app.UIAxes2.Position(4)]);
app.UIAxes2.XLim=[0 I.XData(2)];
app.UIAxes2.YLim=[0 I.YData(2)];
and this the periodic noise code
a=(app.Image);
s=size(a);
[x,y]=meshgrid(1:s(1),1:s(2));
p=sin(x/3+y/5)+1;
noise=(im2double(a)+p/2)/2;
I=imshow(noise,’parent’,app.UIAxes2,…
‘XData’,[1 app.UIAxes2.Position(3)],…
‘YData’,[1 app.UIAxes2.Position(4)]);
app.UIAxes2.XLim=[0 I.XData(2)];
app.UIAxes2.YLim=[0 I.YData(2)];
i also have this low pass filter also doesnt work how can i fix it
a=(app.Image);
f1=fspecial(‘average’,[5,5]);
I=imshow(f1,’parent’,app.UIAxes2,…
‘XData’,[1 app.UIAxes2.Position(3)],…
‘YData’,[1 app.UIAxes2.Position(4)]);
app.UIAxes2.XLim=[0 I.XData(2)];
app.UIAxes2.YLim=[0 I.YData(2e gaussian and periodic noise this is my code for them and they didnt work how can i fix them plz?
this is the gaussina noise code
a=(app.Image);
noise=imnoise(a,’gaussian’);
I=imshow(noise,’parent’,app.UIAxes2,…
‘XData’,[1 app.UIAxes2.Position(3)],…
‘YData’,[1 app.UIAxes2.Position(4)]);
app.UIAxes2.XLim=[0 I.XData(2)];
app.UIAxes2.YLim=[0 I.YData(2)];
and this the periodic noise code
a=(app.Image);
s=size(a);
[x,y]=meshgrid(1:s(1),1:s(2));
p=sin(x/3+y/5)+1;
noise=(im2double(a)+p/2)/2;
I=imshow(noise,’parent’,app.UIAxes2,…
‘XData’,[1 app.UIAxes2.Position(3)],…
‘YData’,[1 app.UIAxes2.Position(4)]);
app.UIAxes2.XLim=[0 I.XData(2)];
app.UIAxes2.YLim=[0 I.YData(2)];
i also have this low pass filter also doesnt work how can i fix it
a=(app.Image);
f1=fspecial(‘average’,[5,5]);
I=imshow(f1,’parent’,app.UIAxes2,…
‘XData’,[1 app.UIAxes2.Position(3)],…
‘YData’,[1 app.UIAxes2.Position(4)]);
app.UIAxes2.XLim=[0 I.XData(2)];
app.UIAxes2.YLim=[0 I.YData(2 e gaussian and periodic noise this is my code for them and they didnt work how can i fix them plz?
this is the gaussina noise code
a=(app.Image);
noise=imnoise(a,’gaussian’);
I=imshow(noise,’parent’,app.UIAxes2,…
‘XData’,[1 app.UIAxes2.Position(3)],…
‘YData’,[1 app.UIAxes2.Position(4)]);
app.UIAxes2.XLim=[0 I.XData(2)];
app.UIAxes2.YLim=[0 I.YData(2)];
and this the periodic noise code
a=(app.Image);
s=size(a);
[x,y]=meshgrid(1:s(1),1:s(2));
p=sin(x/3+y/5)+1;
noise=(im2double(a)+p/2)/2;
I=imshow(noise,’parent’,app.UIAxes2,…
‘XData’,[1 app.UIAxes2.Position(3)],…
‘YData’,[1 app.UIAxes2.Position(4)]);
app.UIAxes2.XLim=[0 I.XData(2)];
app.UIAxes2.YLim=[0 I.YData(2)];
i also have this low pass filter also doesnt work how can i fix it
a=(app.Image);
f1=fspecial(‘average’,[5,5]);
I=imshow(f1,’parent’,app.UIAxes2,…
‘XData’,[1 app.UIAxes2.Position(3)],…
‘YData’,[1 app.UIAxes2.Position(4)]);
app.UIAxes2.XLim=[0 I.XData(2)];
app.UIAxes2.YLim=[0 I.YData(2 #appdesigner #library MATLAB Answers — New Questions
Import data from *.ch file
Hello – has anyone ever tried to import gas chromatograph data from files with .ch extension?Hello – has anyone ever tried to import gas chromatograph data from files with .ch extension? Hello – has anyone ever tried to import gas chromatograph data from files with .ch extension? chromatogram, import, data MATLAB Answers — New Questions
How to generate IP block from QAM receiver example?
I want to generate an IP block from the QAM receiver part from this example:
https://www.mathworks.com/help/comm/ug/hdl-optimized-qam-transmitter-and-receiver.html?searchHighlight=hdl%20qam64&s_tid=srchtitle_support_results_1_hdl%20qam64
To generate an IP core with AXI-stream slave interface using HDL coder it is necessary to specify the valid signal. I do not know what is the right approach to address this.
The model contains a rate transition (there is decimation filter in the Coarse Frequency
Offset Correction ) so it is not possible just wrap the whole system into one enabled subsystem, how it is suggested in this example:
https://www.mathworks.com/help/hdlcoder/ug/model-design-for-axi4-stream-interface-generation.html
How to handle the valid-in signal? Should I split the model to two (or more) enabled submodels before and after the rate transition? Should I manually downsample the valid signal using the downsample block and use the right number of delays to synchronize it?
Is the example just a demonstration of the HDL libraries that nobody intended to use for HDL code generation? What do I miss?I want to generate an IP block from the QAM receiver part from this example:
https://www.mathworks.com/help/comm/ug/hdl-optimized-qam-transmitter-and-receiver.html?searchHighlight=hdl%20qam64&s_tid=srchtitle_support_results_1_hdl%20qam64
To generate an IP core with AXI-stream slave interface using HDL coder it is necessary to specify the valid signal. I do not know what is the right approach to address this.
The model contains a rate transition (there is decimation filter in the Coarse Frequency
Offset Correction ) so it is not possible just wrap the whole system into one enabled subsystem, how it is suggested in this example:
https://www.mathworks.com/help/hdlcoder/ug/model-design-for-axi4-stream-interface-generation.html
How to handle the valid-in signal? Should I split the model to two (or more) enabled submodels before and after the rate transition? Should I manually downsample the valid signal using the downsample block and use the right number of delays to synchronize it?
Is the example just a demonstration of the HDL libraries that nobody intended to use for HDL code generation? What do I miss? I want to generate an IP block from the QAM receiver part from this example:
https://www.mathworks.com/help/comm/ug/hdl-optimized-qam-transmitter-and-receiver.html?searchHighlight=hdl%20qam64&s_tid=srchtitle_support_results_1_hdl%20qam64
To generate an IP core with AXI-stream slave interface using HDL coder it is necessary to specify the valid signal. I do not know what is the right approach to address this.
The model contains a rate transition (there is decimation filter in the Coarse Frequency
Offset Correction ) so it is not possible just wrap the whole system into one enabled subsystem, how it is suggested in this example:
https://www.mathworks.com/help/hdlcoder/ug/model-design-for-axi4-stream-interface-generation.html
How to handle the valid-in signal? Should I split the model to two (or more) enabled submodels before and after the rate transition? Should I manually downsample the valid signal using the downsample block and use the right number of delays to synchronize it?
Is the example just a demonstration of the HDL libraries that nobody intended to use for HDL code generation? What do I miss? qam, axi-stream, multirate, hdl coder, valid signal MATLAB Answers — New Questions
Disappointment with change to section highlighting and run section capability in MATLAB functions after MATLAB 2020b
There is significant information on MATLAB central about this topic already. Here’s a typical question, paraphrased by me:
I recently upgraded from MATLAB 2020b to MATLAB 2023b. I can no longer highlight sections nor can I run sections. How can I recover the old capability?
Here’s my answer:
The new highlighting and run section capability is limited to scripts, not functions in the newer versions of MATLAB! Even with scripts, highlighting requires that one right-click on the left margin (the one with the line numbers) and ensure "Show code folding margin" is enabled with a check mark. This allows a blue bar to be displayed in the margin of the current section (that is, the one in which the cursor appears). The section can be run using either the menu or by clicking the blue bar. But only in scripts, not functions!
Here’s are my disappointments:
In the older versions, I really appreciated the ability to highlight the current section. I prefer to write functions rather than scripts, because I frequently build them into larger MATLAB systems. The new suppression of the old highlighting capability in functions is a real loss to me — the instant visibility of the current section was very valuable.
Similarly, the inability to run sections in functions is a loss of capability. I did not use it frequently, but many of my colleagues use it all the time. Now when they help work on my codes, they won’t have that capability.
This seemed like a needless loss of capability in an upgrade to the (relatively expensive) software development system that MATLAB represents.
The native MATLAB documentation on this is dreadfully lacking. I have spent hours getting to the bottom of this, searching every menu, preference list, and MATLAB Central posting I can find, to no avail.
The MATLAB Central documentation is all over the map, and there don’t seem to be very clear answers anywhere. (I hope this posting helps.)
Here are my recommendations:
Please restore the highlighting and run section capability for functions in the next MATLAB release!
I far prefer block coloring of the current section than the blue bar. I don’t like the extra margin width required by the code folding margin, and I find the blue bar less visible than coloring of the section.
At minimum, all of this should be tailorable as user options.
Thank you.There is significant information on MATLAB central about this topic already. Here’s a typical question, paraphrased by me:
I recently upgraded from MATLAB 2020b to MATLAB 2023b. I can no longer highlight sections nor can I run sections. How can I recover the old capability?
Here’s my answer:
The new highlighting and run section capability is limited to scripts, not functions in the newer versions of MATLAB! Even with scripts, highlighting requires that one right-click on the left margin (the one with the line numbers) and ensure "Show code folding margin" is enabled with a check mark. This allows a blue bar to be displayed in the margin of the current section (that is, the one in which the cursor appears). The section can be run using either the menu or by clicking the blue bar. But only in scripts, not functions!
Here’s are my disappointments:
In the older versions, I really appreciated the ability to highlight the current section. I prefer to write functions rather than scripts, because I frequently build them into larger MATLAB systems. The new suppression of the old highlighting capability in functions is a real loss to me — the instant visibility of the current section was very valuable.
Similarly, the inability to run sections in functions is a loss of capability. I did not use it frequently, but many of my colleagues use it all the time. Now when they help work on my codes, they won’t have that capability.
This seemed like a needless loss of capability in an upgrade to the (relatively expensive) software development system that MATLAB represents.
The native MATLAB documentation on this is dreadfully lacking. I have spent hours getting to the bottom of this, searching every menu, preference list, and MATLAB Central posting I can find, to no avail.
The MATLAB Central documentation is all over the map, and there don’t seem to be very clear answers anywhere. (I hope this posting helps.)
Here are my recommendations:
Please restore the highlighting and run section capability for functions in the next MATLAB release!
I far prefer block coloring of the current section than the blue bar. I don’t like the extra margin width required by the code folding margin, and I find the blue bar less visible than coloring of the section.
At minimum, all of this should be tailorable as user options.
Thank you. There is significant information on MATLAB central about this topic already. Here’s a typical question, paraphrased by me:
I recently upgraded from MATLAB 2020b to MATLAB 2023b. I can no longer highlight sections nor can I run sections. How can I recover the old capability?
Here’s my answer:
The new highlighting and run section capability is limited to scripts, not functions in the newer versions of MATLAB! Even with scripts, highlighting requires that one right-click on the left margin (the one with the line numbers) and ensure "Show code folding margin" is enabled with a check mark. This allows a blue bar to be displayed in the margin of the current section (that is, the one in which the cursor appears). The section can be run using either the menu or by clicking the blue bar. But only in scripts, not functions!
Here’s are my disappointments:
In the older versions, I really appreciated the ability to highlight the current section. I prefer to write functions rather than scripts, because I frequently build them into larger MATLAB systems. The new suppression of the old highlighting capability in functions is a real loss to me — the instant visibility of the current section was very valuable.
Similarly, the inability to run sections in functions is a loss of capability. I did not use it frequently, but many of my colleagues use it all the time. Now when they help work on my codes, they won’t have that capability.
This seemed like a needless loss of capability in an upgrade to the (relatively expensive) software development system that MATLAB represents.
The native MATLAB documentation on this is dreadfully lacking. I have spent hours getting to the bottom of this, searching every menu, preference list, and MATLAB Central posting I can find, to no avail.
The MATLAB Central documentation is all over the map, and there don’t seem to be very clear answers anywhere. (I hope this posting helps.)
Here are my recommendations:
Please restore the highlighting and run section capability for functions in the next MATLAB release!
I far prefer block coloring of the current section than the blue bar. I don’t like the extra margin width required by the code folding margin, and I find the blue bar less visible than coloring of the section.
At minimum, all of this should be tailorable as user options.
Thank you. highlight section, run section, function sections, script sections MATLAB Answers — New Questions
what is (data, event, message) in class and (input, output, local, constant, parameter and data store memory) in scope?
what is (data, event, message) in class and (input, output, local, constant, parameter and data store memory) in scope?what is (data, event, message) in class and (input, output, local, constant, parameter and data store memory) in scope? what is (data, event, message) in class and (input, output, local, constant, parameter and data store memory) in scope? stateflow, matlab MATLAB Answers — New Questions
Using quiver plot,how to show the states of polarization (SoP) in vector beams
As shown in the figure, I want to plot the polarization state of this radial or angular vector beam。As shown in the figure, I want to plot the polarization state of this radial or angular vector beam。 As shown in the figure, I want to plot the polarization state of this radial or angular vector beam。 vector beam, polarization MATLAB Answers — New Questions