Category: Matlab
Category Archives: Matlab
Error using montage function
I have a script that, given 16 images,creates eight montages
I have read in the documentation that it is possible to use an handle to call the montage, and i have done that because i want to be able to show every single montage using imshow to be able to give titles to every one of them.
Running the script causes errors to occur.
Here is the script
clear all;
close all;
clc;
%Importare le immagini
%Posizioni centroidi
PosClust1=imread("Cent_col_cluster1.png");
PosClust2=imread("Cent_col_cluster2.png");
PosClust3=imread("Cent_col_cluster3.png");
PosClust4=imread("Cent_col_cluster4.png");
PosClust5=imread("Cent_col_cluster5.png");
PosClust6=imread("Cent_col_cluster6.png");
PosClust7=imread("Cent_col_cluster7.png");
PosClust8=imread("Cent_col_cluster8.png");
PosClust9=imread("Cent_col_cluster9.png");
%Colori centroidi
Cent_col_Clust1=imread("Cent_pos_cluster1.png");
Cent_col_Clust2=imread("Cent_pos_cluster2.png");
Cent_col_Clust3=imread("Cent_pos_cluster3.png");
Cent_col_Clust4=imread("Cent_pos_cluster4.png");
Cent_col_Clust5=imread("Cent_pos_cluster5.png");
Cent_col_Clust6=imread("Cent_pos_cluster6.png");
Cent_col_Clust7=imread("Cent_pos_cluster7.png");
Cent_col_Clust8=imread("Cent_pos_cluster8.png");
Cent_col_Clust9=imread("Cent_pos_cluster9.png");
%————————————————————————-
%Trasformazione in imagetipe double
%Posizioni centroidi
PosClust1Double=im2double(PosClust1);
PosClust2Double=im2double(PosClust2);
PosClust3Double=im2double(PosClust3);
PosClust4Double=im2double(PosClust4);
PosClust5Double=im2double(PosClust5);
PosClust6Double=im2double(PosClust6);
PosClust7Double=im2double(PosClust7);
PosClust8Double=im2double(PosClust8);
PosClust9Double=im2double(PosClust9);
%Colori centroidi
Cent_col_Clust1Double=im2double(Cent_col_Clust1);
Cent_col_Clust2Double=im2double(Cent_col_Clust2);
Cent_col_Clust3Double=im2double(Cent_col_Clust3);
Cent_col_Clust4Double=im2double(Cent_col_Clust4);
Cent_col_Clust5Double=im2double(Cent_col_Clust5);
Cent_col_Clust6Double=im2double(Cent_col_Clust6);
Cent_col_Clust7Double=im2double(Cent_col_Clust7);
Cent_col_Clust8Double=im2double(Cent_col_Clust8);
Cent_col_Clust9Double=im2double(Cent_col_Clust9);
%Creazione montaggi
Clust1=montage(Cent_col_Clust1Double,PosClust1Double);
Clust2=montage(Cent_col_Clust2Double,PosClust2Double);
Clust3=montage(Cent_col_Clust3Double,PosClust3Double);
Clust4=montage(Cent_col_Clust4Double,PosClust4Double);
Clust5=montage(Cent_col_Clust5Double,PosClust5Double);
Clust6=montage(Cent_col_Clust6Double,PosClust6Double);
Clust7=montage(Cent_col_Clust7Double,PosClust7Double);
Clust8=montage(Cent_col_Clust8Double,PosClust8Double);
Clust9=montage(Cent_col_Clust9Double,PosClust9Double);
%Plot
%Cluster1
imshow(Clust1)
title(‘Cluster1’)
%Cluster2
figure
imshow(Clust2)
title(‘Cluster2’)
%Cluster3
figure
imshow(Clust3)
title(‘Cluster3’)
%Cluster4
figure
imshow(Clust4)
title(‘Cluster4’)
%Cluster5
figure
imshow(Clust5)
title(‘Cluster5’)
%Cluster6
figure
imshow(Clust6)
title(‘Cluster6’)
%Cluster7
figure
imshow(Clust7)
title(‘Cluster7’)
%Cluster8
figure
imshow(Clust8)
title(‘Cluster8’)
%Cluster9
figure
imshow(Clust9)
title(‘Cluster9’)
These errors appear
Error using images.internal.imageDisplayParsePVPairs
Invalid input arguments.
Error in images.internal.imageDisplayParseInputs (line 70)
[common_args,specific_args] = images.internal.imageDisplayParsePVPairs(varargin{:});
Error in imshow (line 253)
images.internal.imageDisplayParseInputs({‘Parent’,’Border’,’Reduce’},preparsed_varargin{:});
Error in montage (line 231)
hh = imshow(bigImage,cmap,parentArgs{:},interpolationArgs{:});
Error in Montaggi_kmeans (line 52)
Clust1=montage(Cent_col_Clust1Double,PosClust1Double);
All Cent_col_Clust images are 420x560x3 uint8
All PosClust images are 595x842x3 uint8
All Cent_col_ClustDouble images are 420x560x3 double
All PosClustDouble images are 595x842x3 double
I have no clue what the problem is. Any ideas?
I cannot post all images, daily attachments limit is 10.I have a script that, given 16 images,creates eight montages
I have read in the documentation that it is possible to use an handle to call the montage, and i have done that because i want to be able to show every single montage using imshow to be able to give titles to every one of them.
Running the script causes errors to occur.
Here is the script
clear all;
close all;
clc;
%Importare le immagini
%Posizioni centroidi
PosClust1=imread("Cent_col_cluster1.png");
PosClust2=imread("Cent_col_cluster2.png");
PosClust3=imread("Cent_col_cluster3.png");
PosClust4=imread("Cent_col_cluster4.png");
PosClust5=imread("Cent_col_cluster5.png");
PosClust6=imread("Cent_col_cluster6.png");
PosClust7=imread("Cent_col_cluster7.png");
PosClust8=imread("Cent_col_cluster8.png");
PosClust9=imread("Cent_col_cluster9.png");
%Colori centroidi
Cent_col_Clust1=imread("Cent_pos_cluster1.png");
Cent_col_Clust2=imread("Cent_pos_cluster2.png");
Cent_col_Clust3=imread("Cent_pos_cluster3.png");
Cent_col_Clust4=imread("Cent_pos_cluster4.png");
Cent_col_Clust5=imread("Cent_pos_cluster5.png");
Cent_col_Clust6=imread("Cent_pos_cluster6.png");
Cent_col_Clust7=imread("Cent_pos_cluster7.png");
Cent_col_Clust8=imread("Cent_pos_cluster8.png");
Cent_col_Clust9=imread("Cent_pos_cluster9.png");
%————————————————————————-
%Trasformazione in imagetipe double
%Posizioni centroidi
PosClust1Double=im2double(PosClust1);
PosClust2Double=im2double(PosClust2);
PosClust3Double=im2double(PosClust3);
PosClust4Double=im2double(PosClust4);
PosClust5Double=im2double(PosClust5);
PosClust6Double=im2double(PosClust6);
PosClust7Double=im2double(PosClust7);
PosClust8Double=im2double(PosClust8);
PosClust9Double=im2double(PosClust9);
%Colori centroidi
Cent_col_Clust1Double=im2double(Cent_col_Clust1);
Cent_col_Clust2Double=im2double(Cent_col_Clust2);
Cent_col_Clust3Double=im2double(Cent_col_Clust3);
Cent_col_Clust4Double=im2double(Cent_col_Clust4);
Cent_col_Clust5Double=im2double(Cent_col_Clust5);
Cent_col_Clust6Double=im2double(Cent_col_Clust6);
Cent_col_Clust7Double=im2double(Cent_col_Clust7);
Cent_col_Clust8Double=im2double(Cent_col_Clust8);
Cent_col_Clust9Double=im2double(Cent_col_Clust9);
%Creazione montaggi
Clust1=montage(Cent_col_Clust1Double,PosClust1Double);
Clust2=montage(Cent_col_Clust2Double,PosClust2Double);
Clust3=montage(Cent_col_Clust3Double,PosClust3Double);
Clust4=montage(Cent_col_Clust4Double,PosClust4Double);
Clust5=montage(Cent_col_Clust5Double,PosClust5Double);
Clust6=montage(Cent_col_Clust6Double,PosClust6Double);
Clust7=montage(Cent_col_Clust7Double,PosClust7Double);
Clust8=montage(Cent_col_Clust8Double,PosClust8Double);
Clust9=montage(Cent_col_Clust9Double,PosClust9Double);
%Plot
%Cluster1
imshow(Clust1)
title(‘Cluster1’)
%Cluster2
figure
imshow(Clust2)
title(‘Cluster2’)
%Cluster3
figure
imshow(Clust3)
title(‘Cluster3’)
%Cluster4
figure
imshow(Clust4)
title(‘Cluster4’)
%Cluster5
figure
imshow(Clust5)
title(‘Cluster5’)
%Cluster6
figure
imshow(Clust6)
title(‘Cluster6’)
%Cluster7
figure
imshow(Clust7)
title(‘Cluster7’)
%Cluster8
figure
imshow(Clust8)
title(‘Cluster8’)
%Cluster9
figure
imshow(Clust9)
title(‘Cluster9’)
These errors appear
Error using images.internal.imageDisplayParsePVPairs
Invalid input arguments.
Error in images.internal.imageDisplayParseInputs (line 70)
[common_args,specific_args] = images.internal.imageDisplayParsePVPairs(varargin{:});
Error in imshow (line 253)
images.internal.imageDisplayParseInputs({‘Parent’,’Border’,’Reduce’},preparsed_varargin{:});
Error in montage (line 231)
hh = imshow(bigImage,cmap,parentArgs{:},interpolationArgs{:});
Error in Montaggi_kmeans (line 52)
Clust1=montage(Cent_col_Clust1Double,PosClust1Double);
All Cent_col_Clust images are 420x560x3 uint8
All PosClust images are 595x842x3 uint8
All Cent_col_ClustDouble images are 420x560x3 double
All PosClustDouble images are 595x842x3 double
I have no clue what the problem is. Any ideas?
I cannot post all images, daily attachments limit is 10. I have a script that, given 16 images,creates eight montages
I have read in the documentation that it is possible to use an handle to call the montage, and i have done that because i want to be able to show every single montage using imshow to be able to give titles to every one of them.
Running the script causes errors to occur.
Here is the script
clear all;
close all;
clc;
%Importare le immagini
%Posizioni centroidi
PosClust1=imread("Cent_col_cluster1.png");
PosClust2=imread("Cent_col_cluster2.png");
PosClust3=imread("Cent_col_cluster3.png");
PosClust4=imread("Cent_col_cluster4.png");
PosClust5=imread("Cent_col_cluster5.png");
PosClust6=imread("Cent_col_cluster6.png");
PosClust7=imread("Cent_col_cluster7.png");
PosClust8=imread("Cent_col_cluster8.png");
PosClust9=imread("Cent_col_cluster9.png");
%Colori centroidi
Cent_col_Clust1=imread("Cent_pos_cluster1.png");
Cent_col_Clust2=imread("Cent_pos_cluster2.png");
Cent_col_Clust3=imread("Cent_pos_cluster3.png");
Cent_col_Clust4=imread("Cent_pos_cluster4.png");
Cent_col_Clust5=imread("Cent_pos_cluster5.png");
Cent_col_Clust6=imread("Cent_pos_cluster6.png");
Cent_col_Clust7=imread("Cent_pos_cluster7.png");
Cent_col_Clust8=imread("Cent_pos_cluster8.png");
Cent_col_Clust9=imread("Cent_pos_cluster9.png");
%————————————————————————-
%Trasformazione in imagetipe double
%Posizioni centroidi
PosClust1Double=im2double(PosClust1);
PosClust2Double=im2double(PosClust2);
PosClust3Double=im2double(PosClust3);
PosClust4Double=im2double(PosClust4);
PosClust5Double=im2double(PosClust5);
PosClust6Double=im2double(PosClust6);
PosClust7Double=im2double(PosClust7);
PosClust8Double=im2double(PosClust8);
PosClust9Double=im2double(PosClust9);
%Colori centroidi
Cent_col_Clust1Double=im2double(Cent_col_Clust1);
Cent_col_Clust2Double=im2double(Cent_col_Clust2);
Cent_col_Clust3Double=im2double(Cent_col_Clust3);
Cent_col_Clust4Double=im2double(Cent_col_Clust4);
Cent_col_Clust5Double=im2double(Cent_col_Clust5);
Cent_col_Clust6Double=im2double(Cent_col_Clust6);
Cent_col_Clust7Double=im2double(Cent_col_Clust7);
Cent_col_Clust8Double=im2double(Cent_col_Clust8);
Cent_col_Clust9Double=im2double(Cent_col_Clust9);
%Creazione montaggi
Clust1=montage(Cent_col_Clust1Double,PosClust1Double);
Clust2=montage(Cent_col_Clust2Double,PosClust2Double);
Clust3=montage(Cent_col_Clust3Double,PosClust3Double);
Clust4=montage(Cent_col_Clust4Double,PosClust4Double);
Clust5=montage(Cent_col_Clust5Double,PosClust5Double);
Clust6=montage(Cent_col_Clust6Double,PosClust6Double);
Clust7=montage(Cent_col_Clust7Double,PosClust7Double);
Clust8=montage(Cent_col_Clust8Double,PosClust8Double);
Clust9=montage(Cent_col_Clust9Double,PosClust9Double);
%Plot
%Cluster1
imshow(Clust1)
title(‘Cluster1’)
%Cluster2
figure
imshow(Clust2)
title(‘Cluster2’)
%Cluster3
figure
imshow(Clust3)
title(‘Cluster3’)
%Cluster4
figure
imshow(Clust4)
title(‘Cluster4’)
%Cluster5
figure
imshow(Clust5)
title(‘Cluster5’)
%Cluster6
figure
imshow(Clust6)
title(‘Cluster6’)
%Cluster7
figure
imshow(Clust7)
title(‘Cluster7’)
%Cluster8
figure
imshow(Clust8)
title(‘Cluster8’)
%Cluster9
figure
imshow(Clust9)
title(‘Cluster9’)
These errors appear
Error using images.internal.imageDisplayParsePVPairs
Invalid input arguments.
Error in images.internal.imageDisplayParseInputs (line 70)
[common_args,specific_args] = images.internal.imageDisplayParsePVPairs(varargin{:});
Error in imshow (line 253)
images.internal.imageDisplayParseInputs({‘Parent’,’Border’,’Reduce’},preparsed_varargin{:});
Error in montage (line 231)
hh = imshow(bigImage,cmap,parentArgs{:},interpolationArgs{:});
Error in Montaggi_kmeans (line 52)
Clust1=montage(Cent_col_Clust1Double,PosClust1Double);
All Cent_col_Clust images are 420x560x3 uint8
All PosClust images are 595x842x3 uint8
All Cent_col_ClustDouble images are 420x560x3 double
All PosClustDouble images are 595x842x3 double
I have no clue what the problem is. Any ideas?
I cannot post all images, daily attachments limit is 10. montage, image processing, matlab function MATLAB Answers — New Questions
Simulink Embedded Coder Zero Initialization of Local Variables Not Working
Hello, I am using Embedded Coder on Simulink Model (MATLAB 2022B). I want Local variables of generated code to be initialized to zero. I already unticked ‘Remove root level I/O zero initialization’ and ‘Remove internal data zero initialization’ so code shouldn’t optimize initializations. These two settings initialize Global variables to zero, but don’t initialize Local variables to zero. There is an example of generated code and how I want it to be. How can I do it? Thanks for your help.
How it is:
void step_function(uint16_t in1, uint16_t in2)
{
uint16_t Divide;
uint16_t UnitDelay1;
…
How it should be:
void step_function(uint16_t in1, uint16_t in2)
{
uint16_t Divide = 0;
uint16_t UnitDelay1 = 0;
…Hello, I am using Embedded Coder on Simulink Model (MATLAB 2022B). I want Local variables of generated code to be initialized to zero. I already unticked ‘Remove root level I/O zero initialization’ and ‘Remove internal data zero initialization’ so code shouldn’t optimize initializations. These two settings initialize Global variables to zero, but don’t initialize Local variables to zero. There is an example of generated code and how I want it to be. How can I do it? Thanks for your help.
How it is:
void step_function(uint16_t in1, uint16_t in2)
{
uint16_t Divide;
uint16_t UnitDelay1;
…
How it should be:
void step_function(uint16_t in1, uint16_t in2)
{
uint16_t Divide = 0;
uint16_t UnitDelay1 = 0;
… Hello, I am using Embedded Coder on Simulink Model (MATLAB 2022B). I want Local variables of generated code to be initialized to zero. I already unticked ‘Remove root level I/O zero initialization’ and ‘Remove internal data zero initialization’ so code shouldn’t optimize initializations. These two settings initialize Global variables to zero, but don’t initialize Local variables to zero. There is an example of generated code and how I want it to be. How can I do it? Thanks for your help.
How it is:
void step_function(uint16_t in1, uint16_t in2)
{
uint16_t Divide;
uint16_t UnitDelay1;
…
How it should be:
void step_function(uint16_t in1, uint16_t in2)
{
uint16_t Divide = 0;
uint16_t UnitDelay1 = 0;
… embedded coder, code generation, simulink, zero initialization MATLAB Answers — New Questions
jsonencode not encoding entire large structure data
Hi
I have a large table converting to structure type and then use the jsonencode to encode the data.
However I realized that not all data has been converted to json, since the ending was not "]" or "}".
Is there a fail-safe way to convert large table to json?
Thanks,Hi
I have a large table converting to structure type and then use the jsonencode to encode the data.
However I realized that not all data has been converted to json, since the ending was not "]" or "}".
Is there a fail-safe way to convert large table to json?
Thanks, Hi
I have a large table converting to structure type and then use the jsonencode to encode the data.
However I realized that not all data has been converted to json, since the ending was not "]" or "}".
Is there a fail-safe way to convert large table to json?
Thanks, matlab MATLAB Answers — New Questions
Is the oscillation in the picture a boundary condition problem?
Hi,
I have an equation which is as follows
When I solve this equation using the pdepe it shows an oscillation pattern at the edge as it is here (shown by arrow).
I changed my parameters a lot but this oscillation sometime reduces, but not zero. My bc are as follows
pl = 0;
ql = 1;
pr = 0;
qr = 1;
Can you tell how to reduce this oscillations?
Also, in the above equation, for the diffusion coefficient (sigma) the minimum value for which the pdepe converges is 1 below which the solution becomes diverging, it should not be actually.
with regardsHi,
I have an equation which is as follows
When I solve this equation using the pdepe it shows an oscillation pattern at the edge as it is here (shown by arrow).
I changed my parameters a lot but this oscillation sometime reduces, but not zero. My bc are as follows
pl = 0;
ql = 1;
pr = 0;
qr = 1;
Can you tell how to reduce this oscillations?
Also, in the above equation, for the diffusion coefficient (sigma) the minimum value for which the pdepe converges is 1 below which the solution becomes diverging, it should not be actually.
with regards Hi,
I have an equation which is as follows
When I solve this equation using the pdepe it shows an oscillation pattern at the edge as it is here (shown by arrow).
I changed my parameters a lot but this oscillation sometime reduces, but not zero. My bc are as follows
pl = 0;
ql = 1;
pr = 0;
qr = 1;
Can you tell how to reduce this oscillations?
Also, in the above equation, for the diffusion coefficient (sigma) the minimum value for which the pdepe converges is 1 below which the solution becomes diverging, it should not be actually.
with regards pdepe MATLAB Answers — New Questions
Using Simulink to read/send MAVlink packets to/from a PX4
Hello,
I am getting an "Arrays have incompatible sizes for this operation" error when running the ‘jetsoncpu_pixhawk_interface’ public Simulink model. I am hooked up to the PX4 Cube Orange Plus flight controller. Regardless of when I use the serial send/receive blocks or even the MAVlink blocks, I run into this issue.
Please let me know if anyone has any suggestions for this issue.
Send and Receive MAVLink Packets on Jetson Boards – MATLAB & Simulink (mathworks.com)Hello,
I am getting an "Arrays have incompatible sizes for this operation" error when running the ‘jetsoncpu_pixhawk_interface’ public Simulink model. I am hooked up to the PX4 Cube Orange Plus flight controller. Regardless of when I use the serial send/receive blocks or even the MAVlink blocks, I run into this issue.
Please let me know if anyone has any suggestions for this issue.
Send and Receive MAVLink Packets on Jetson Boards – MATLAB & Simulink (mathworks.com) Hello,
I am getting an "Arrays have incompatible sizes for this operation" error when running the ‘jetsoncpu_pixhawk_interface’ public Simulink model. I am hooked up to the PX4 Cube Orange Plus flight controller. Regardless of when I use the serial send/receive blocks or even the MAVlink blocks, I run into this issue.
Please let me know if anyone has any suggestions for this issue.
Send and Receive MAVLink Packets on Jetson Boards – MATLAB & Simulink (mathworks.com) transferred MATLAB Answers — New Questions
Is there a method to predict one point in the future based on multiple point of past prediction? (LSTM univariate)
To explain the title above, how do i get prediction for i+1 based on i and i-1 combined?
I had already done the training and got the training info inside variable net.
This is an example of the code for LSTM trained net to predict 1 value into the future from Mathworks website.
for i=1:numTimeStepsTest
[net,YPred(:,i)] = predictAndUpdateState(net,YPred(:,i-1));
end
I appreciate if anyone can help direct me to any forum/article regarding this matter if it has been answered previously.
Thank you.To explain the title above, how do i get prediction for i+1 based on i and i-1 combined?
I had already done the training and got the training info inside variable net.
This is an example of the code for LSTM trained net to predict 1 value into the future from Mathworks website.
for i=1:numTimeStepsTest
[net,YPred(:,i)] = predictAndUpdateState(net,YPred(:,i-1));
end
I appreciate if anyone can help direct me to any forum/article regarding this matter if it has been answered previously.
Thank you. To explain the title above, how do i get prediction for i+1 based on i and i-1 combined?
I had already done the training and got the training info inside variable net.
This is an example of the code for LSTM trained net to predict 1 value into the future from Mathworks website.
for i=1:numTimeStepsTest
[net,YPred(:,i)] = predictAndUpdateState(net,YPred(:,i-1));
end
I appreciate if anyone can help direct me to any forum/article regarding this matter if it has been answered previously.
Thank you. neural network MATLAB Answers — New Questions
Fick’s diffusion in matlab
Hello,
I want to model Fick’s diffusion of nanoparticles in a 2D domain filled with water. Is it possible to do that in matlab?
Regards,Hello,
I want to model Fick’s diffusion of nanoparticles in a 2D domain filled with water. Is it possible to do that in matlab?
Regards, Hello,
I want to model Fick’s diffusion of nanoparticles in a 2D domain filled with water. Is it possible to do that in matlab?
Regards, diffusion, fick’s law MATLAB Answers — New Questions
how to delete the empty row in the excel with matlab
hi, as the title description, i want use matlab to delete the empty rows in the excel which has many rows, how to realize.hi, as the title description, i want use matlab to delete the empty rows in the excel which has many rows, how to realize. hi, as the title description, i want use matlab to delete the empty rows in the excel which has many rows, how to realize. excel operate, matlab MATLAB Answers — New Questions
which angle to use in svpwm switching timings generation
for grid connected inverter should i use the angle from pll as theta reference or the angle which is generated from the voltagesfor grid connected inverter should i use the angle from pll as theta reference or the angle which is generated from the voltages for grid connected inverter should i use the angle from pll as theta reference or the angle which is generated from the voltages reference angle selection MATLAB Answers — New Questions
Unable to run PIL simulation using ESP-32
I am trying do PIL using ESP-32 Hardware and I am getting this error:
Error:Unable to run PIL simulation of "Subsystem".
Configuration parameters for the model do not support these connectivity configurations: STM32 Targets, Arduino Board, ARM Cortex-M3 (QEMU), STM32F4-Discovery (ST-LINK), STM32F4-Discovery (Serial), STM32 Ethernet, STM32 Microcontroller, Texas Instruments Code Composer Studio (IDE), Texas Instruments Code Composer Studio (TCP/IP), Texas Instruments Code Composer Studio (Serial), Teensy connectivity config using serial
Update configuration parameters or create a supported connectivity configuration. See Create PIL Target Connectivity Configuration.I am trying do PIL using ESP-32 Hardware and I am getting this error:
Error:Unable to run PIL simulation of "Subsystem".
Configuration parameters for the model do not support these connectivity configurations: STM32 Targets, Arduino Board, ARM Cortex-M3 (QEMU), STM32F4-Discovery (ST-LINK), STM32F4-Discovery (Serial), STM32 Ethernet, STM32 Microcontroller, Texas Instruments Code Composer Studio (IDE), Texas Instruments Code Composer Studio (TCP/IP), Texas Instruments Code Composer Studio (Serial), Teensy connectivity config using serial
Update configuration parameters or create a supported connectivity configuration. See Create PIL Target Connectivity Configuration. I am trying do PIL using ESP-32 Hardware and I am getting this error:
Error:Unable to run PIL simulation of "Subsystem".
Configuration parameters for the model do not support these connectivity configurations: STM32 Targets, Arduino Board, ARM Cortex-M3 (QEMU), STM32F4-Discovery (ST-LINK), STM32F4-Discovery (Serial), STM32 Ethernet, STM32 Microcontroller, Texas Instruments Code Composer Studio (IDE), Texas Instruments Code Composer Studio (TCP/IP), Texas Instruments Code Composer Studio (Serial), Teensy connectivity config using serial
Update configuration parameters or create a supported connectivity configuration. See Create PIL Target Connectivity Configuration. pil MATLAB Answers — New Questions
how can i apply wavelet filter to this code
% generate a waveform
f0 =100;
fs=1000;
pw = 0.1;
pri = 1;
npulses = 100;
s = cos(2*pi*f0*(0:1/fs:pw)); % it can be any other waveform of your choice
s(round(fs*pri)) = 0; % PRI
s = repmat(s, npulses, 1); % npulses
% echo: delayed signal
tau = 0.3;
ntau = round(fs*tau);
amp = 0.5;
e = amp* circshift(s, ntau);
% add noise
sigma = 0.1;
r = s + e + sigma*randn(size(s));
y = pulsint(r);
plot((0:length(s)-1)/fs, r)% generate a waveform
f0 =100;
fs=1000;
pw = 0.1;
pri = 1;
npulses = 100;
s = cos(2*pi*f0*(0:1/fs:pw)); % it can be any other waveform of your choice
s(round(fs*pri)) = 0; % PRI
s = repmat(s, npulses, 1); % npulses
% echo: delayed signal
tau = 0.3;
ntau = round(fs*tau);
amp = 0.5;
e = amp* circshift(s, ntau);
% add noise
sigma = 0.1;
r = s + e + sigma*randn(size(s));
y = pulsint(r);
plot((0:length(s)-1)/fs, r) % generate a waveform
f0 =100;
fs=1000;
pw = 0.1;
pri = 1;
npulses = 100;
s = cos(2*pi*f0*(0:1/fs:pw)); % it can be any other waveform of your choice
s(round(fs*pri)) = 0; % PRI
s = repmat(s, npulses, 1); % npulses
% echo: delayed signal
tau = 0.3;
ntau = round(fs*tau);
amp = 0.5;
e = amp* circshift(s, ntau);
% add noise
sigma = 0.1;
r = s + e + sigma*randn(size(s));
y = pulsint(r);
plot((0:length(s)-1)/fs, r) wavelet filter MATLAB Answers — New Questions
How to access the system clipboard in MATLAB Web App Server
I am creating an app in MATLAB Web App Server 2024a. Accessing the system’s clipboard using the clipboard function is not supported, as described in the unsupported functionality page. I am looking for an alternative so that users can paste the contents of their clipboard into a UITable.
Interestingly, despite the lack of support for the clipboard function, users are still able to paste text from their clipboard using the key combination to paste if they double click a cell in the table first so that there’s a flashing cursor. This leads me to believe that Web App Server is able to access the system clipboard, although I can’t seem to figure out how to do so (ie. if there’s a different function to call). Is there a way for me to access the user’s clipboard in Web App Server without the clipboard function? As it stands, users can only paste if they’ve double-clicked a cell in the table. A single click won’t do, and I’d like to add functionality to enable that.
Any insights are appreciated. Thank you!I am creating an app in MATLAB Web App Server 2024a. Accessing the system’s clipboard using the clipboard function is not supported, as described in the unsupported functionality page. I am looking for an alternative so that users can paste the contents of their clipboard into a UITable.
Interestingly, despite the lack of support for the clipboard function, users are still able to paste text from their clipboard using the key combination to paste if they double click a cell in the table first so that there’s a flashing cursor. This leads me to believe that Web App Server is able to access the system clipboard, although I can’t seem to figure out how to do so (ie. if there’s a different function to call). Is there a way for me to access the user’s clipboard in Web App Server without the clipboard function? As it stands, users can only paste if they’ve double-clicked a cell in the table. A single click won’t do, and I’d like to add functionality to enable that.
Any insights are appreciated. Thank you! I am creating an app in MATLAB Web App Server 2024a. Accessing the system’s clipboard using the clipboard function is not supported, as described in the unsupported functionality page. I am looking for an alternative so that users can paste the contents of their clipboard into a UITable.
Interestingly, despite the lack of support for the clipboard function, users are still able to paste text from their clipboard using the key combination to paste if they double click a cell in the table first so that there’s a flashing cursor. This leads me to believe that Web App Server is able to access the system clipboard, although I can’t seem to figure out how to do so (ie. if there’s a different function to call). Is there a way for me to access the user’s clipboard in Web App Server without the clipboard function? As it stands, users can only paste if they’ve double-clicked a cell in the table. A single click won’t do, and I’d like to add functionality to enable that.
Any insights are appreciated. Thank you! matlab, appdesigner, web app server, clipboard, uitable MATLAB Answers — New Questions
exponential increase in wave form in three phase grid connected svpwm
for the three phase grid connected system for the svpwm i have used the angle from pll, sector selection is also obtained using pll,vdc of 400v and Ts=1/10000. i have used current controller for obtaining vref. i’m experiencing exponentially increasing waveform in vref. what should i do to settle it downfor the three phase grid connected system for the svpwm i have used the angle from pll, sector selection is also obtained using pll,vdc of 400v and Ts=1/10000. i have used current controller for obtaining vref. i’m experiencing exponentially increasing waveform in vref. what should i do to settle it down for the three phase grid connected system for the svpwm i have used the angle from pll, sector selection is also obtained using pll,vdc of 400v and Ts=1/10000. i have used current controller for obtaining vref. i’m experiencing exponentially increasing waveform in vref. what should i do to settle it down exponential increase in vref in svpwm MATLAB Answers — New Questions
PSO algorithm value problem
Hi
I have a pso code, but i have a little problem. Here is a code
clc;
clear;
close all;
%% Problem Definition
CostFunction = @(x) Sphere(x); % Cost Function
nVar = 5; % Number of Unknown (Deceision) Variables
VarSize = [1 nVar]; % Matrix Size of Decision Variables
VarMin = -10; % Lower bound of Decesion Variable
VarMax = 10; % Upper bound of Decesion Variable
%% Parameters of PSO
MaxIt = 100; % Maximum Number of Iterations
nPop = 50; % Population Size (Swarm Size)
wdamp = 0.99; % Damping Ratio of Inertia Coefficient
w = 1; % Inertia Coefficient
c1 = 2; % Personal Acceleration Coefficient
c2 = 2; % Social Acceleration Coefficient
%% Initialization
% The Particle Template
empty_particle.Position = [];
empty_particle.Velocity = [];
empty_particle.Cost = [];
empty_particle.Best.Position = [];
empty_particle.Best.Cost = [];
% Create Population Array
particle = repmat(empty_particle, nPop, 1);
% Initialize Global Best
GlobalBest.Cost = inf;
% Initialize Population Members
for i=1:nPop
% Generate Random Solution
particle(i).Position = unifrnd(VarMin, VarMax, VarSize);
% Initialize Velocity
particle(i).Velocity = zeros(VarSize);
% Evaluation
particle(i).Cost = CostFunction(particle(i).Position);
% Update the Personal Best
particle(i).Best.Position = particle(i).Position;
particle(i).Best.Cost = particle(i).Cost;
% Update Global Best
if particle(i).Best.Cost < GlobalBest.Cost
GlobalBest = particle(i).Best;
end
end
%
% Array to Hold Best Cost Value on Each Iteration
BestCosts = zeros(MaxIt, 1);
%% Main Loop of PSO
for it=1:MaxIt
for i=1:nPop
% Update Velocity
particle(i).Velocity = w*particle(i).Velocity …
+ c1*rand(VarSize).*(particle(i).Best.Position – particle(i).Position) …
+ c2*rand(VarSize).*(GlobalBest.Position – particle(i).Position);
% Update Position
particle(i).Postion = particle(i).Position + particle(i).Velocity;
% Evaluation
particle(i).Cost = CostFunction(particle(i).Position);
% Update Personal Best
if particle(i).Cost < particle(i).Best.Cost
particle(i).Best.Position = particle(i).Position;
particle(i).Best.Cost = particle(i).Cost;
% Update Global Best
if particle(i).Best.Cost < GlobalBest.Cost
GlobalBest = particle(i).Best;
end
end
end
% Store the Best Cost Value
BestCosts(it) = GlobalBest.Cost;
% Display Iteration Information
disp([‘Iteration ‘ num2str(it) ‘: Best Cost = ‘ num2str(BestCosts(it))]);
% Damping Interia Coefficient
w = w * wdamp;
end
figure;
plot(BestCosts, ‘LineWidth’, 2);
xlabel(‘Iteration’);
ylabel(‘Best Cost’);
grid on;
Value of BestCosts is alwyas the same, but shouldnt. I dont know how to fix it. Please help me.Hi
I have a pso code, but i have a little problem. Here is a code
clc;
clear;
close all;
%% Problem Definition
CostFunction = @(x) Sphere(x); % Cost Function
nVar = 5; % Number of Unknown (Deceision) Variables
VarSize = [1 nVar]; % Matrix Size of Decision Variables
VarMin = -10; % Lower bound of Decesion Variable
VarMax = 10; % Upper bound of Decesion Variable
%% Parameters of PSO
MaxIt = 100; % Maximum Number of Iterations
nPop = 50; % Population Size (Swarm Size)
wdamp = 0.99; % Damping Ratio of Inertia Coefficient
w = 1; % Inertia Coefficient
c1 = 2; % Personal Acceleration Coefficient
c2 = 2; % Social Acceleration Coefficient
%% Initialization
% The Particle Template
empty_particle.Position = [];
empty_particle.Velocity = [];
empty_particle.Cost = [];
empty_particle.Best.Position = [];
empty_particle.Best.Cost = [];
% Create Population Array
particle = repmat(empty_particle, nPop, 1);
% Initialize Global Best
GlobalBest.Cost = inf;
% Initialize Population Members
for i=1:nPop
% Generate Random Solution
particle(i).Position = unifrnd(VarMin, VarMax, VarSize);
% Initialize Velocity
particle(i).Velocity = zeros(VarSize);
% Evaluation
particle(i).Cost = CostFunction(particle(i).Position);
% Update the Personal Best
particle(i).Best.Position = particle(i).Position;
particle(i).Best.Cost = particle(i).Cost;
% Update Global Best
if particle(i).Best.Cost < GlobalBest.Cost
GlobalBest = particle(i).Best;
end
end
%
% Array to Hold Best Cost Value on Each Iteration
BestCosts = zeros(MaxIt, 1);
%% Main Loop of PSO
for it=1:MaxIt
for i=1:nPop
% Update Velocity
particle(i).Velocity = w*particle(i).Velocity …
+ c1*rand(VarSize).*(particle(i).Best.Position – particle(i).Position) …
+ c2*rand(VarSize).*(GlobalBest.Position – particle(i).Position);
% Update Position
particle(i).Postion = particle(i).Position + particle(i).Velocity;
% Evaluation
particle(i).Cost = CostFunction(particle(i).Position);
% Update Personal Best
if particle(i).Cost < particle(i).Best.Cost
particle(i).Best.Position = particle(i).Position;
particle(i).Best.Cost = particle(i).Cost;
% Update Global Best
if particle(i).Best.Cost < GlobalBest.Cost
GlobalBest = particle(i).Best;
end
end
end
% Store the Best Cost Value
BestCosts(it) = GlobalBest.Cost;
% Display Iteration Information
disp([‘Iteration ‘ num2str(it) ‘: Best Cost = ‘ num2str(BestCosts(it))]);
% Damping Interia Coefficient
w = w * wdamp;
end
figure;
plot(BestCosts, ‘LineWidth’, 2);
xlabel(‘Iteration’);
ylabel(‘Best Cost’);
grid on;
Value of BestCosts is alwyas the same, but shouldnt. I dont know how to fix it. Please help me. Hi
I have a pso code, but i have a little problem. Here is a code
clc;
clear;
close all;
%% Problem Definition
CostFunction = @(x) Sphere(x); % Cost Function
nVar = 5; % Number of Unknown (Deceision) Variables
VarSize = [1 nVar]; % Matrix Size of Decision Variables
VarMin = -10; % Lower bound of Decesion Variable
VarMax = 10; % Upper bound of Decesion Variable
%% Parameters of PSO
MaxIt = 100; % Maximum Number of Iterations
nPop = 50; % Population Size (Swarm Size)
wdamp = 0.99; % Damping Ratio of Inertia Coefficient
w = 1; % Inertia Coefficient
c1 = 2; % Personal Acceleration Coefficient
c2 = 2; % Social Acceleration Coefficient
%% Initialization
% The Particle Template
empty_particle.Position = [];
empty_particle.Velocity = [];
empty_particle.Cost = [];
empty_particle.Best.Position = [];
empty_particle.Best.Cost = [];
% Create Population Array
particle = repmat(empty_particle, nPop, 1);
% Initialize Global Best
GlobalBest.Cost = inf;
% Initialize Population Members
for i=1:nPop
% Generate Random Solution
particle(i).Position = unifrnd(VarMin, VarMax, VarSize);
% Initialize Velocity
particle(i).Velocity = zeros(VarSize);
% Evaluation
particle(i).Cost = CostFunction(particle(i).Position);
% Update the Personal Best
particle(i).Best.Position = particle(i).Position;
particle(i).Best.Cost = particle(i).Cost;
% Update Global Best
if particle(i).Best.Cost < GlobalBest.Cost
GlobalBest = particle(i).Best;
end
end
%
% Array to Hold Best Cost Value on Each Iteration
BestCosts = zeros(MaxIt, 1);
%% Main Loop of PSO
for it=1:MaxIt
for i=1:nPop
% Update Velocity
particle(i).Velocity = w*particle(i).Velocity …
+ c1*rand(VarSize).*(particle(i).Best.Position – particle(i).Position) …
+ c2*rand(VarSize).*(GlobalBest.Position – particle(i).Position);
% Update Position
particle(i).Postion = particle(i).Position + particle(i).Velocity;
% Evaluation
particle(i).Cost = CostFunction(particle(i).Position);
% Update Personal Best
if particle(i).Cost < particle(i).Best.Cost
particle(i).Best.Position = particle(i).Position;
particle(i).Best.Cost = particle(i).Cost;
% Update Global Best
if particle(i).Best.Cost < GlobalBest.Cost
GlobalBest = particle(i).Best;
end
end
end
% Store the Best Cost Value
BestCosts(it) = GlobalBest.Cost;
% Display Iteration Information
disp([‘Iteration ‘ num2str(it) ‘: Best Cost = ‘ num2str(BestCosts(it))]);
% Damping Interia Coefficient
w = w * wdamp;
end
figure;
plot(BestCosts, ‘LineWidth’, 2);
xlabel(‘Iteration’);
ylabel(‘Best Cost’);
grid on;
Value of BestCosts is alwyas the same, but shouldnt. I dont know how to fix it. Please help me. pso algorithm MATLAB Answers — New Questions
get all rows from table by more than one categorical
Hi All,
I want to filter my table and get subtables for statistical calcs.
I use the commant:
D=table
D_sub=D(D.LogID== ‘2’,:);
To get all rows with the LogID 2. How can I expand this commant to get for example all data from LogID 2,3,4 and 5 with one commant?
Than you
MarkusHi All,
I want to filter my table and get subtables for statistical calcs.
I use the commant:
D=table
D_sub=D(D.LogID== ‘2’,:);
To get all rows with the LogID 2. How can I expand this commant to get for example all data from LogID 2,3,4 and 5 with one commant?
Than you
Markus Hi All,
I want to filter my table and get subtables for statistical calcs.
I use the commant:
D=table
D_sub=D(D.LogID== ‘2’,:);
To get all rows with the LogID 2. How can I expand this commant to get for example all data from LogID 2,3,4 and 5 with one commant?
Than you
Markus table, subtable, categorical, matlab MATLAB Answers — New Questions
callback in TreeNode Propertis
hi, i want to execute calback by click Node2 to execute other function
It’s possibile to do it?hi, i want to execute calback by click Node2 to execute other function
It’s possibile to do it? hi, i want to execute calback by click Node2 to execute other function
It’s possibile to do it? callback in treenode propertis MATLAB Answers — New Questions
Linear Regression, line of best fit
If I have data for vectors x = [ ] and y= [ ], how do I find and plot the linear regression/line of best fit? Once I have plotted the line of best fit, how do I record the slope of that line of best fit to some variable "a"?If I have data for vectors x = [ ] and y= [ ], how do I find and plot the linear regression/line of best fit? Once I have plotted the line of best fit, how do I record the slope of that line of best fit to some variable "a"? If I have data for vectors x = [ ] and y= [ ], how do I find and plot the linear regression/line of best fit? Once I have plotted the line of best fit, how do I record the slope of that line of best fit to some variable "a"? line of best fit MATLAB Answers — New Questions
Your variables are reaching 2GB limit,revert to save -v7.3 This will be slower but avoids matlab not saving the data.
When I was processing data with MATLAB on Ubuntu 20, I received the following message:
Your variables are reaching 2GB limit, revert to save -v7.3
This will be slower but avoids matlab not saving the data
I then changed the MAT file save format to 7.3 in the MATLAB preferences, but after restarting the software and the computer, I still encountered the same error when processing data. How should I resolve this?When I was processing data with MATLAB on Ubuntu 20, I received the following message:
Your variables are reaching 2GB limit, revert to save -v7.3
This will be slower but avoids matlab not saving the data
I then changed the MAT file save format to 7.3 in the MATLAB preferences, but after restarting the software and the computer, I still encountered the same error when processing data. How should I resolve this? When I was processing data with MATLAB on Ubuntu 20, I received the following message:
Your variables are reaching 2GB limit, revert to save -v7.3
This will be slower but avoids matlab not saving the data
I then changed the MAT file save format to 7.3 in the MATLAB preferences, but after restarting the software and the computer, I still encountered the same error when processing data. How should I resolve this? variables limit, ubuntu MATLAB Answers — New Questions
Changing colors of outlier markers, median and whiskers in a box and whisker plot
Hello,
So, currently I have the following script to generate a box and whisker plot:
x1 = randn(128, 1);
x2 = randn(100, 1);
X = [x1; x2];
colors = [0 0.4470 0.7410; 0.8500 0.3250 0.0980];
grp = [ones(size(x1)); 2.*ones(size(x2))];
h = boxplot(X, grp, …
‘Colors’,colors, …
‘Symbol’,’.’)
for j=1:size(h,2)
patch(get(h(5,j),’XData’),get(h(5,j),’YData’),get(h(5,j),’Color’),’FaceAlpha’,.7);
end
The result I get is this one:
What I would like to do is to make the whisker line, the median line and the outline markers all black. The end result would be something like this:
Thanks!Hello,
So, currently I have the following script to generate a box and whisker plot:
x1 = randn(128, 1);
x2 = randn(100, 1);
X = [x1; x2];
colors = [0 0.4470 0.7410; 0.8500 0.3250 0.0980];
grp = [ones(size(x1)); 2.*ones(size(x2))];
h = boxplot(X, grp, …
‘Colors’,colors, …
‘Symbol’,’.’)
for j=1:size(h,2)
patch(get(h(5,j),’XData’),get(h(5,j),’YData’),get(h(5,j),’Color’),’FaceAlpha’,.7);
end
The result I get is this one:
What I would like to do is to make the whisker line, the median line and the outline markers all black. The end result would be something like this:
Thanks! Hello,
So, currently I have the following script to generate a box and whisker plot:
x1 = randn(128, 1);
x2 = randn(100, 1);
X = [x1; x2];
colors = [0 0.4470 0.7410; 0.8500 0.3250 0.0980];
grp = [ones(size(x1)); 2.*ones(size(x2))];
h = boxplot(X, grp, …
‘Colors’,colors, …
‘Symbol’,’.’)
for j=1:size(h,2)
patch(get(h(5,j),’XData’),get(h(5,j),’YData’),get(h(5,j),’Color’),’FaceAlpha’,.7);
end
The result I get is this one:
What I would like to do is to make the whisker line, the median line and the outline markers all black. The end result would be something like this:
Thanks! plotting, plot MATLAB Answers — New Questions
Run Python function from inside Simulink
Hello!
I have a simulink electric motor example that is being controlled via PWM.
I want the controller that spits out the PWM to be a Python function ( a NN controller I have written in Python INPUT: motor rpm OUT: PWM signal) — and it returns in real time floating point numbers. e.g. 2,504; 2,103 etc.
I want that to be the input for the PWM block in the Simulink model. And the output of the electric motor (rpm) to be the input for the Python function (I have a special measurement input for that function).
Has anybody had any succes with linking .py files and Simulink ?
__________________________________________________________________________________________________________
And to run the python files, do I need to containerize them or to do something special ? Because there are 5 files in the whole project which I will need. I cannot run the function alone.
Thanks a lot!Hello!
I have a simulink electric motor example that is being controlled via PWM.
I want the controller that spits out the PWM to be a Python function ( a NN controller I have written in Python INPUT: motor rpm OUT: PWM signal) — and it returns in real time floating point numbers. e.g. 2,504; 2,103 etc.
I want that to be the input for the PWM block in the Simulink model. And the output of the electric motor (rpm) to be the input for the Python function (I have a special measurement input for that function).
Has anybody had any succes with linking .py files and Simulink ?
__________________________________________________________________________________________________________
And to run the python files, do I need to containerize them or to do something special ? Because there are 5 files in the whole project which I will need. I cannot run the function alone.
Thanks a lot! Hello!
I have a simulink electric motor example that is being controlled via PWM.
I want the controller that spits out the PWM to be a Python function ( a NN controller I have written in Python INPUT: motor rpm OUT: PWM signal) — and it returns in real time floating point numbers. e.g. 2,504; 2,103 etc.
I want that to be the input for the PWM block in the Simulink model. And the output of the electric motor (rpm) to be the input for the Python function (I have a special measurement input for that function).
Has anybody had any succes with linking .py files and Simulink ?
__________________________________________________________________________________________________________
And to run the python files, do I need to containerize them or to do something special ? Because there are 5 files in the whole project which I will need. I cannot run the function alone.
Thanks a lot! python, simulink, electric_motor_control, embedded matlab function MATLAB Answers — New Questions