Category: Matlab
Category Archives: Matlab
preprocessing the digital signal with digital filtets
I have been given a Brain-computer-interface BCI dataset, namely AVI_SSVEP_Dataset.
https://www.setzner.com/avi-ssvep-dataset/
The dataset has 7 different BCI target frequencies for each target on screen.
I need to preprocess digital signal with digital filters and classify each EEG epoch or each EEG trial. For this purpose I am asked to divide the data into two groups train and test data as 66% train and 33% test for each frequency. Afterwards I am required to create and train a machine learning model to predict the unseen test data correctly.
First you can extract 7 SNR at target frequencies as your features. SNR is measured as the signal at the frequency to the noise energy at the neighboring frequencies.
Training the model with these features you can obtain a machine learning model (using Matlab classification learner) for prediction of the test signals. Once you predict these signal labels, you can check predictions with actual true labels and compute accuracy of the model.
How can i perform this task can anyone help meI have been given a Brain-computer-interface BCI dataset, namely AVI_SSVEP_Dataset.
https://www.setzner.com/avi-ssvep-dataset/
The dataset has 7 different BCI target frequencies for each target on screen.
I need to preprocess digital signal with digital filters and classify each EEG epoch or each EEG trial. For this purpose I am asked to divide the data into two groups train and test data as 66% train and 33% test for each frequency. Afterwards I am required to create and train a machine learning model to predict the unseen test data correctly.
First you can extract 7 SNR at target frequencies as your features. SNR is measured as the signal at the frequency to the noise energy at the neighboring frequencies.
Training the model with these features you can obtain a machine learning model (using Matlab classification learner) for prediction of the test signals. Once you predict these signal labels, you can check predictions with actual true labels and compute accuracy of the model.
How can i perform this task can anyone help me I have been given a Brain-computer-interface BCI dataset, namely AVI_SSVEP_Dataset.
https://www.setzner.com/avi-ssvep-dataset/
The dataset has 7 different BCI target frequencies for each target on screen.
I need to preprocess digital signal with digital filters and classify each EEG epoch or each EEG trial. For this purpose I am asked to divide the data into two groups train and test data as 66% train and 33% test for each frequency. Afterwards I am required to create and train a machine learning model to predict the unseen test data correctly.
First you can extract 7 SNR at target frequencies as your features. SNR is measured as the signal at the frequency to the noise energy at the neighboring frequencies.
Training the model with these features you can obtain a machine learning model (using Matlab classification learner) for prediction of the test signals. Once you predict these signal labels, you can check predictions with actual true labels and compute accuracy of the model.
How can i perform this task can anyone help me digital signal processing, filtering, eeg, machine learning, machine training MATLAB Answers — New Questions
Defining a Y-Based custom datatip with a non-auto format
I am trying to create a custom datatip, where the value is a 2-input function, and that the format is not ‘auto’. The following code shows the main part of the problem:
p = plot((1:10).^2); % Define a line
% X-Based Datatip, with `auto` formatting
p.DataTipTemplate.DataTipRows = [p.DataTipTemplate.DataTipRows; dataTipTextRow("A", @(x) 2*x, ‘auto’)];
% X-Based Datatip, with floating point formatting
p.DataTipTemplate.DataTipRows = [p.DataTipTemplate.DataTipRows; dataTipTextRow("B", @(x) 2*x, ‘%.3f’)];
% Y-Based Datatip, with `auto` formatting
p.DataTipTemplate.DataTipRows = [p.DataTipTemplate.DataTipRows; dataTipTextRow("C", @(~,y) 2*y, ‘auto’)];
% Y-Based Datatip, with floating point formatting
p.DataTipTemplate.DataTipRows = [p.DataTipTemplate.DataTipRows; dataTipTextRow("D", @(~,y) 2*y, ‘%.3f’)];
I get an error on the last line:
Error using matlab.graphics.datatip.DataTipTemplate/set.DataTipRows
Not enough input arguments.
I am not sure if I am using this feature incorrectly, or if this is a bugI am trying to create a custom datatip, where the value is a 2-input function, and that the format is not ‘auto’. The following code shows the main part of the problem:
p = plot((1:10).^2); % Define a line
% X-Based Datatip, with `auto` formatting
p.DataTipTemplate.DataTipRows = [p.DataTipTemplate.DataTipRows; dataTipTextRow("A", @(x) 2*x, ‘auto’)];
% X-Based Datatip, with floating point formatting
p.DataTipTemplate.DataTipRows = [p.DataTipTemplate.DataTipRows; dataTipTextRow("B", @(x) 2*x, ‘%.3f’)];
% Y-Based Datatip, with `auto` formatting
p.DataTipTemplate.DataTipRows = [p.DataTipTemplate.DataTipRows; dataTipTextRow("C", @(~,y) 2*y, ‘auto’)];
% Y-Based Datatip, with floating point formatting
p.DataTipTemplate.DataTipRows = [p.DataTipTemplate.DataTipRows; dataTipTextRow("D", @(~,y) 2*y, ‘%.3f’)];
I get an error on the last line:
Error using matlab.graphics.datatip.DataTipTemplate/set.DataTipRows
Not enough input arguments.
I am not sure if I am using this feature incorrectly, or if this is a bug I am trying to create a custom datatip, where the value is a 2-input function, and that the format is not ‘auto’. The following code shows the main part of the problem:
p = plot((1:10).^2); % Define a line
% X-Based Datatip, with `auto` formatting
p.DataTipTemplate.DataTipRows = [p.DataTipTemplate.DataTipRows; dataTipTextRow("A", @(x) 2*x, ‘auto’)];
% X-Based Datatip, with floating point formatting
p.DataTipTemplate.DataTipRows = [p.DataTipTemplate.DataTipRows; dataTipTextRow("B", @(x) 2*x, ‘%.3f’)];
% Y-Based Datatip, with `auto` formatting
p.DataTipTemplate.DataTipRows = [p.DataTipTemplate.DataTipRows; dataTipTextRow("C", @(~,y) 2*y, ‘auto’)];
% Y-Based Datatip, with floating point formatting
p.DataTipTemplate.DataTipRows = [p.DataTipTemplate.DataTipRows; dataTipTextRow("D", @(~,y) 2*y, ‘%.3f’)];
I get an error on the last line:
Error using matlab.graphics.datatip.DataTipTemplate/set.DataTipRows
Not enough input arguments.
I am not sure if I am using this feature incorrectly, or if this is a bug error, plot MATLAB Answers — New Questions
How to solve singular matrix?
function dx = plant(t,x,u)
dx = zeros(6,1);
x1 = [x(1);x(2);x(3)];
x2 = [x(4);x(5);x(6)];
beta3=0.33;
beta4=2;
D=0.1;
M=1;
a1=0.1;%k1
a2=0.1;%k2
a3=0.01;%k3
a4=0.1;%k4
b=2.3;
f2= [(-(D*a1+a3)*x1(1)/M)-(D*a2*b^3*x2(3)/M);1;2];
G=[(1+a4*b^3)/M 0 0;0 1 0;0 0 1];
p1=[beta3*sin(x1(1));1;2];
p2=[beta4*(x2(1)^2);0;3];
dx1 = x2 + p1;
dx2 = f2 + G*u + p2;
dx = [dx1; dx2];function dx = plant(t,x,u)
dx = zeros(6,1);
x1 = [x(1);x(2);x(3)];
x2 = [x(4);x(5);x(6)];
beta3=0.33;
beta4=2;
D=0.1;
M=1;
a1=0.1;%k1
a2=0.1;%k2
a3=0.01;%k3
a4=0.1;%k4
b=2.3;
f2= [(-(D*a1+a3)*x1(1)/M)-(D*a2*b^3*x2(3)/M);1;2];
G=[(1+a4*b^3)/M 0 0;0 1 0;0 0 1];
p1=[beta3*sin(x1(1));1;2];
p2=[beta4*(x2(1)^2);0;3];
dx1 = x2 + p1;
dx2 = f2 + G*u + p2;
dx = [dx1; dx2]; function dx = plant(t,x,u)
dx = zeros(6,1);
x1 = [x(1);x(2);x(3)];
x2 = [x(4);x(5);x(6)];
beta3=0.33;
beta4=2;
D=0.1;
M=1;
a1=0.1;%k1
a2=0.1;%k2
a3=0.01;%k3
a4=0.1;%k4
b=2.3;
f2= [(-(D*a1+a3)*x1(1)/M)-(D*a2*b^3*x2(3)/M);1;2];
G=[(1+a4*b^3)/M 0 0;0 1 0;0 0 1];
p1=[beta3*sin(x1(1));1;2];
p2=[beta4*(x2(1)^2);0;3];
dx1 = x2 + p1;
dx2 = f2 + G*u + p2;
dx = [dx1; dx2]; singular matrix MATLAB Answers — New Questions
mex can’t find Visual Studio 2022 C++ when running clibgen.generateLibraryDefinition
>> internal.cxxfe.util.getMexCompilerInfo
‘C:Program’ is not recognized as an internal or external command,
operable program or batch file.
‘cl’ is not recognized as an internal or external command,
operable program or batch file.
I have reinstalled VS 2022 to a path that isn’t even in C:Program Files. Rerun mex -setup C++. Over the last week, this was working for other DLL’s, but I had to recompile a DLL written for VS 2013 which Matlab doesn’t support and went from 32 bit to 64 bit because the libary version of QT had to change from 5.7 to 6.7 to support VS 2022 instead of VS 2013. So now the DLL is now x64 compiled in VS 2022 with QT 6.7 using Matlab R2023b 64 bit.>> internal.cxxfe.util.getMexCompilerInfo
‘C:Program’ is not recognized as an internal or external command,
operable program or batch file.
‘cl’ is not recognized as an internal or external command,
operable program or batch file.
I have reinstalled VS 2022 to a path that isn’t even in C:Program Files. Rerun mex -setup C++. Over the last week, this was working for other DLL’s, but I had to recompile a DLL written for VS 2013 which Matlab doesn’t support and went from 32 bit to 64 bit because the libary version of QT had to change from 5.7 to 6.7 to support VS 2022 instead of VS 2013. So now the DLL is now x64 compiled in VS 2022 with QT 6.7 using Matlab R2023b 64 bit. >> internal.cxxfe.util.getMexCompilerInfo
‘C:Program’ is not recognized as an internal or external command,
operable program or batch file.
‘cl’ is not recognized as an internal or external command,
operable program or batch file.
I have reinstalled VS 2022 to a path that isn’t even in C:Program Files. Rerun mex -setup C++. Over the last week, this was working for other DLL’s, but I had to recompile a DLL written for VS 2013 which Matlab doesn’t support and went from 32 bit to 64 bit because the libary version of QT had to change from 5.7 to 6.7 to support VS 2022 instead of VS 2013. So now the DLL is now x64 compiled in VS 2022 with QT 6.7 using Matlab R2023b 64 bit. mex, mex compiler MATLAB Answers — New Questions
How to write append a few lines in model_initialize function for a MATLAB function block in Simulink?
I am creating a MATLAB function block in Simulink. For that function block I want to append a few lines of code in the model_initialize function. I know that I can just create an initialize subsystem to write that code. However, I do not want to create a separate initialize block.
Is it possible to generate a few lines of code in the model_initialize function for a MATLAB block in Simulink? This is for Embedded Coder code generation.I am creating a MATLAB function block in Simulink. For that function block I want to append a few lines of code in the model_initialize function. I know that I can just create an initialize subsystem to write that code. However, I do not want to create a separate initialize block.
Is it possible to generate a few lines of code in the model_initialize function for a MATLAB block in Simulink? This is for Embedded Coder code generation. I am creating a MATLAB function block in Simulink. For that function block I want to append a few lines of code in the model_initialize function. I know that I can just create an initialize subsystem to write that code. However, I do not want to create a separate initialize block.
Is it possible to generate a few lines of code in the model_initialize function for a MATLAB block in Simulink? This is for Embedded Coder code generation. matlab block in simulink, model_initialize MATLAB Answers — New Questions
These 3 codes when run give error
I have 3 codes as given in attachment. When I run the "main.m", it gives the following error:
Index in position 1 exceeds array bounds. Index must not exceed 1.
Error in ArGeo (line 17)
cosd(b(2, :)) .* cosd(b(1, :)); % x-component
Error in main>@(b)ArGeo(b,u,Noise)+penaltyTerm(b,u) (line 25)
[time,gBest,gBestScore]=WHO(20,100,lb,ub,dim,@(b) ArGeo(b,u,Noise)+penaltyTerm(b, u));
Error in WHO (line 47)
group(i).cost=fobj(group(i).pos);
Error in main (line 25)
[time,gBest,gBestScore]=WHO(20,100,lb,ub,dim,@(b) ArGeo(b,u,Noise)+penaltyTerm(b, u));
>>I have 3 codes as given in attachment. When I run the "main.m", it gives the following error:
Index in position 1 exceeds array bounds. Index must not exceed 1.
Error in ArGeo (line 17)
cosd(b(2, :)) .* cosd(b(1, :)); % x-component
Error in main>@(b)ArGeo(b,u,Noise)+penaltyTerm(b,u) (line 25)
[time,gBest,gBestScore]=WHO(20,100,lb,ub,dim,@(b) ArGeo(b,u,Noise)+penaltyTerm(b, u));
Error in WHO (line 47)
group(i).cost=fobj(group(i).pos);
Error in main (line 25)
[time,gBest,gBestScore]=WHO(20,100,lb,ub,dim,@(b) ArGeo(b,u,Noise)+penaltyTerm(b, u));
>> I have 3 codes as given in attachment. When I run the "main.m", it gives the following error:
Index in position 1 exceeds array bounds. Index must not exceed 1.
Error in ArGeo (line 17)
cosd(b(2, :)) .* cosd(b(1, :)); % x-component
Error in main>@(b)ArGeo(b,u,Noise)+penaltyTerm(b,u) (line 25)
[time,gBest,gBestScore]=WHO(20,100,lb,ub,dim,@(b) ArGeo(b,u,Noise)+penaltyTerm(b, u));
Error in WHO (line 47)
group(i).cost=fobj(group(i).pos);
Error in main (line 25)
[time,gBest,gBestScore]=WHO(20,100,lb,ub,dim,@(b) ArGeo(b,u,Noise)+penaltyTerm(b, u));
>> why is the error, how to modify, why bounds exceed MATLAB Answers — New Questions
wordcloud error and failure to update wordcloud
Hi, I have received an error while trying out an example in MATLAB. It appears that the wordcloud function is not working despite reinstalling the toolbox. There is no other .m file that takes precedence. May I know how to resolve this? Thanks!Hi, I have received an error while trying out an example in MATLAB. It appears that the wordcloud function is not working despite reinstalling the toolbox. There is no other .m file that takes precedence. May I know how to resolve this? Thanks! Hi, I have received an error while trying out an example in MATLAB. It appears that the wordcloud function is not working despite reinstalling the toolbox. There is no other .m file that takes precedence. May I know how to resolve this? Thanks! wordcloud, text MATLAB Answers — New Questions
I need to extract latitude and longitude from geotiff file
I am working with SMAP soil moisture data of downscaled product of 1km. The image is in geotiff format, i couldnt extract latitude and longitude value for the data, while visualising the image the x and y axis appears to be row and coloumn number. Please help me for the same
matlab version: MATLAB R2019a
geotiff file: NSIDC-0779_EASE2_G1km_SMAP_SM_DS_20160101.tifI am working with SMAP soil moisture data of downscaled product of 1km. The image is in geotiff format, i couldnt extract latitude and longitude value for the data, while visualising the image the x and y axis appears to be row and coloumn number. Please help me for the same
matlab version: MATLAB R2019a
geotiff file: NSIDC-0779_EASE2_G1km_SMAP_SM_DS_20160101.tif I am working with SMAP soil moisture data of downscaled product of 1km. The image is in geotiff format, i couldnt extract latitude and longitude value for the data, while visualising the image the x and y axis appears to be row and coloumn number. Please help me for the same
matlab version: MATLAB R2019a
geotiff file: NSIDC-0779_EASE2_G1km_SMAP_SM_DS_20160101.tif geotiff, plotting, satellite data MATLAB Answers — New Questions
Authentiate with login credentials
I am trying to login to my portfolio on morningstar (https://www.morningstar.com/portfolio-manager/my-view) and am having some issues. I have reviewed several other posts on this topic (certainly this one: https://www.mathworks.com/matlabcentral/answers/480026-how-do-i-preemptively-include-a-basic-authentication-header-when-working-with-webread-webwrite) and I am having a hard time. I am getting an bad request error (status 400) when I try to communicate my login credentials to the login page. I have tried:
options = weboptions(‘HeaderFields’,{‘Authorization’,…
[‘Basic ‘ matlab.net.base64encode([myUsername ‘:’ myPassword])]});
AND
options = weboptions(‘Username’,myUsername,’Password’,myPassword);
to set my credentials before using webread on the login page. What am I missing? I am able to communicate (without real username or password obviously) with https://httpbin.org/hidden-basic-auth/myUser/myPassword succesfully as discussed in the example above.I am trying to login to my portfolio on morningstar (https://www.morningstar.com/portfolio-manager/my-view) and am having some issues. I have reviewed several other posts on this topic (certainly this one: https://www.mathworks.com/matlabcentral/answers/480026-how-do-i-preemptively-include-a-basic-authentication-header-when-working-with-webread-webwrite) and I am having a hard time. I am getting an bad request error (status 400) when I try to communicate my login credentials to the login page. I have tried:
options = weboptions(‘HeaderFields’,{‘Authorization’,…
[‘Basic ‘ matlab.net.base64encode([myUsername ‘:’ myPassword])]});
AND
options = weboptions(‘Username’,myUsername,’Password’,myPassword);
to set my credentials before using webread on the login page. What am I missing? I am able to communicate (without real username or password obviously) with https://httpbin.org/hidden-basic-auth/myUser/myPassword succesfully as discussed in the example above. I am trying to login to my portfolio on morningstar (https://www.morningstar.com/portfolio-manager/my-view) and am having some issues. I have reviewed several other posts on this topic (certainly this one: https://www.mathworks.com/matlabcentral/answers/480026-how-do-i-preemptively-include-a-basic-authentication-header-when-working-with-webread-webwrite) and I am having a hard time. I am getting an bad request error (status 400) when I try to communicate my login credentials to the login page. I have tried:
options = weboptions(‘HeaderFields’,{‘Authorization’,…
[‘Basic ‘ matlab.net.base64encode([myUsername ‘:’ myPassword])]});
AND
options = weboptions(‘Username’,myUsername,’Password’,myPassword);
to set my credentials before using webread on the login page. What am I missing? I am able to communicate (without real username or password obviously) with https://httpbin.org/hidden-basic-auth/myUser/myPassword succesfully as discussed in the example above. credentials, authenticate webread, login webread MATLAB Answers — New Questions
Delay balancing error while using HDL coder
Hello
I am using Matlab 2023b version. While generating the HDL code I am facing the issue with delay balancing.I received the following error:
" Delay balancing unsuccessful because an extra 10 cycles of latency introduced by optimizations in the feedback loop cannot be offset using design delays for the loop latency budget. If you are modeling at data rate (high-level description of algorithm without hardware implementation details), refer to the clock-rate pipelining report for more details. If you are modeling at clock rate, consider increasing the latency budget by adding more design delays in the feedback loop. Refer to the delay balancing report for more details."
I inserted some delay blocks in series with the error block,but still the error remains same.I didn’t faced this issues when I was generating using 2021 version.Do I need to change anything in the setting?. Is there anything I should do with the delay blocks.Hello
I am using Matlab 2023b version. While generating the HDL code I am facing the issue with delay balancing.I received the following error:
" Delay balancing unsuccessful because an extra 10 cycles of latency introduced by optimizations in the feedback loop cannot be offset using design delays for the loop latency budget. If you are modeling at data rate (high-level description of algorithm without hardware implementation details), refer to the clock-rate pipelining report for more details. If you are modeling at clock rate, consider increasing the latency budget by adding more design delays in the feedback loop. Refer to the delay balancing report for more details."
I inserted some delay blocks in series with the error block,but still the error remains same.I didn’t faced this issues when I was generating using 2021 version.Do I need to change anything in the setting?. Is there anything I should do with the delay blocks. Hello
I am using Matlab 2023b version. While generating the HDL code I am facing the issue with delay balancing.I received the following error:
" Delay balancing unsuccessful because an extra 10 cycles of latency introduced by optimizations in the feedback loop cannot be offset using design delays for the loop latency budget. If you are modeling at data rate (high-level description of algorithm without hardware implementation details), refer to the clock-rate pipelining report for more details. If you are modeling at clock rate, consider increasing the latency budget by adding more design delays in the feedback loop. Refer to the delay balancing report for more details."
I inserted some delay blocks in series with the error block,but still the error remains same.I didn’t faced this issues when I was generating using 2021 version.Do I need to change anything in the setting?. Is there anything I should do with the delay blocks. hdl coder, delay balancing MATLAB Answers — New Questions
How to read data from input boxes in app design using MATLAB
I have created an app, such that the response will be dynamically changing w.r.t input given. For example, the design view will have numeric edit field as No. of rooms and start button. If user give some value in No. of rooms, those many tabs will be generated with edit fields: Room no., No. of baskets in each room, percentage of fruits in each basket, No. of mangoes in each basket and also able to generate input boxes based on inputs given. There are few issues: Issue_1: Even though i’m not entering any value in room number and percentage of fruits in each basket, the app is able to generate next steps, that should not happen, instead the app should proceed for next steps after entering some value in room no and percentage of fruits in each basket. Issue_2: If I decrease the numeric value in No. of mangoes in each basket, the ‘import excel’ button are not able to change(By mistakenly if i have given 3,7,4 and press enter again if i have to give 2,3,2 the ‘import excel’ button won’t change).Issue_3: Need to plot the graph in such a format like(Room No.’x’_ basket’y’_’z’%of fruits in ‘y’ basket_Mango_’n’) and so on, which means for each ‘excel read’ button the graph should be displayed in an order on the tab. I have attached the app file and data required for plotting graphs.I have created an app, such that the response will be dynamically changing w.r.t input given. For example, the design view will have numeric edit field as No. of rooms and start button. If user give some value in No. of rooms, those many tabs will be generated with edit fields: Room no., No. of baskets in each room, percentage of fruits in each basket, No. of mangoes in each basket and also able to generate input boxes based on inputs given. There are few issues: Issue_1: Even though i’m not entering any value in room number and percentage of fruits in each basket, the app is able to generate next steps, that should not happen, instead the app should proceed for next steps after entering some value in room no and percentage of fruits in each basket. Issue_2: If I decrease the numeric value in No. of mangoes in each basket, the ‘import excel’ button are not able to change(By mistakenly if i have given 3,7,4 and press enter again if i have to give 2,3,2 the ‘import excel’ button won’t change).Issue_3: Need to plot the graph in such a format like(Room No.’x’_ basket’y’_’z’%of fruits in ‘y’ basket_Mango_’n’) and so on, which means for each ‘excel read’ button the graph should be displayed in an order on the tab. I have attached the app file and data required for plotting graphs. I have created an app, such that the response will be dynamically changing w.r.t input given. For example, the design view will have numeric edit field as No. of rooms and start button. If user give some value in No. of rooms, those many tabs will be generated with edit fields: Room no., No. of baskets in each room, percentage of fruits in each basket, No. of mangoes in each basket and also able to generate input boxes based on inputs given. There are few issues: Issue_1: Even though i’m not entering any value in room number and percentage of fruits in each basket, the app is able to generate next steps, that should not happen, instead the app should proceed for next steps after entering some value in room no and percentage of fruits in each basket. Issue_2: If I decrease the numeric value in No. of mangoes in each basket, the ‘import excel’ button are not able to change(By mistakenly if i have given 3,7,4 and press enter again if i have to give 2,3,2 the ‘import excel’ button won’t change).Issue_3: Need to plot the graph in such a format like(Room No.’x’_ basket’y’_’z’%of fruits in ‘y’ basket_Mango_’n’) and so on, which means for each ‘excel read’ button the graph should be displayed in an order on the tab. I have attached the app file and data required for plotting graphs. matlab, appdesigner MATLAB Answers — New Questions
Unable to complete PX4 support packages due to unresponsive firmware upload menu?
During Hardware setup for PX4 support packages, there is a compulsion intrduced to upload the firmware, but it became unresponsive and didn’t stop or close unless I kill that terminal process manually. When I searched for the solution the help page only covers for Windows users, since I am on Ubutntu 22.04, I can’t apply the solution, Kindly help me as soon as possible.During Hardware setup for PX4 support packages, there is a compulsion intrduced to upload the firmware, but it became unresponsive and didn’t stop or close unless I kill that terminal process manually. When I searched for the solution the help page only covers for Windows users, since I am on Ubutntu 22.04, I can’t apply the solution, Kindly help me as soon as possible. During Hardware setup for PX4 support packages, there is a compulsion intrduced to upload the firmware, but it became unresponsive and didn’t stop or close unless I kill that terminal process manually. When I searched for the solution the help page only covers for Windows users, since I am on Ubutntu 22.04, I can’t apply the solution, Kindly help me as soon as possible. px4, uav support packages, px4 hardware support packages MATLAB Answers — New Questions
Score transform for RUSBoost in fitcensemble
The documentation for the predict function of fitcensemble lists the score transforms (to convert scores to probabilities) for the following model methods:
Bag (none)
AdaBoostM1 (doublelogit)
GentleBoost (doublelogit)
LogitBoost (doublelogit)
But it does not list a score transform for several other possible fitcensemble methods. Are these documented somewhere else?
I’m currently most interested in RUSBoost, because that is the method I am using.The documentation for the predict function of fitcensemble lists the score transforms (to convert scores to probabilities) for the following model methods:
Bag (none)
AdaBoostM1 (doublelogit)
GentleBoost (doublelogit)
LogitBoost (doublelogit)
But it does not list a score transform for several other possible fitcensemble methods. Are these documented somewhere else?
I’m currently most interested in RUSBoost, because that is the method I am using. The documentation for the predict function of fitcensemble lists the score transforms (to convert scores to probabilities) for the following model methods:
Bag (none)
AdaBoostM1 (doublelogit)
GentleBoost (doublelogit)
LogitBoost (doublelogit)
But it does not list a score transform for several other possible fitcensemble methods. Are these documented somewhere else?
I’m currently most interested in RUSBoost, because that is the method I am using. fitcensemble, score transform MATLAB Answers — New Questions
Need to calculate 12 experimental coefficients highlighted in red. Have found F’n and F’t values with 200 samples, and all other values like Vw, Vc, a, de, Cs are known.
I need to calculate experimental coefficients K, K1, K4, a0, b0, c0 using F’n 200 sample experimental values. Similarly K’, K2, K3, a0, b0, c0 to be calculated using F’t 200 sample experimental values. Note that Vw, Vc, a, de, Cs values are known for 200 sample values. Please help in with this matlab program.I need to calculate experimental coefficients K, K1, K4, a0, b0, c0 using F’n 200 sample experimental values. Similarly K’, K2, K3, a0, b0, c0 to be calculated using F’t 200 sample experimental values. Note that Vw, Vc, a, de, Cs values are known for 200 sample values. Please help in with this matlab program. I need to calculate experimental coefficients K, K1, K4, a0, b0, c0 using F’n 200 sample experimental values. Similarly K’, K2, K3, a0, b0, c0 to be calculated using F’t 200 sample experimental values. Note that Vw, Vc, a, de, Cs values are known for 200 sample values. Please help in with this matlab program. regression, polynomial regression, curve fitting MATLAB Answers — New Questions
How do I lower an image quality?
I’m new to matlab and need to create a for loop that gradually lowers the quality of an image in a GUI. I tried searching on the internet but can’t find how to do it. I’m aware it’s probably imwrite but I can’t get it to work properly.
The image is .jpeg format, I just need to know how to lower it once and I’ll figure everything else from there.I’m new to matlab and need to create a for loop that gradually lowers the quality of an image in a GUI. I tried searching on the internet but can’t find how to do it. I’m aware it’s probably imwrite but I can’t get it to work properly.
The image is .jpeg format, I just need to know how to lower it once and I’ll figure everything else from there. I’m new to matlab and need to create a for loop that gradually lowers the quality of an image in a GUI. I tried searching on the internet but can’t find how to do it. I’m aware it’s probably imwrite but I can’t get it to work properly.
The image is .jpeg format, I just need to know how to lower it once and I’ll figure everything else from there. matlab gui, image processing MATLAB Answers — New Questions
Scatter plot text behind plotted data when image copied.
I have a figure containing a scatter plot overlaid with a fitted poly. I have added some text labels to the data.
When I copy the image and paste as enhanced metafile, the text appears behind the plotted data, even when I set the text object to ‘top’ and/or set the current axes to ‘top’:
t = text(x, y, str); % Adding a text label
uistack(t, ‘top’); % Bring the text to the front
set(gca, ‘Layer’, ‘top’);
If I change the renderer to ‘opengl’, the image copies correctly, but the pasted image quality is very poor.
This behaviour is repeatable on any figure of this type.I have a figure containing a scatter plot overlaid with a fitted poly. I have added some text labels to the data.
When I copy the image and paste as enhanced metafile, the text appears behind the plotted data, even when I set the text object to ‘top’ and/or set the current axes to ‘top’:
t = text(x, y, str); % Adding a text label
uistack(t, ‘top’); % Bring the text to the front
set(gca, ‘Layer’, ‘top’);
If I change the renderer to ‘opengl’, the image copies correctly, but the pasted image quality is very poor.
This behaviour is repeatable on any figure of this type. I have a figure containing a scatter plot overlaid with a fitted poly. I have added some text labels to the data.
When I copy the image and paste as enhanced metafile, the text appears behind the plotted data, even when I set the text object to ‘top’ and/or set the current axes to ‘top’:
t = text(x, y, str); % Adding a text label
uistack(t, ‘top’); % Bring the text to the front
set(gca, ‘Layer’, ‘top’);
If I change the renderer to ‘opengl’, the image copies correctly, but the pasted image quality is very poor.
This behaviour is repeatable on any figure of this type. scatter plot, plot text, renderer, figure copy MATLAB Answers — New Questions
Need help with restricted areas and warp gates
clc
% Prompts user for the desired input method
Input = input(‘Type of input (User or File): ‘, ‘s’);
if strcmp(Input, ‘file’)
% File input
filename = input(‘Filename ‘, ‘s’);
fid = fopen(filename);
Width = fscanf(fid, ‘%f’,1);
Radius = fscanf(fid, ‘%f’,1);
Direction = fscanf(fid,’%f’, 1);
Coords = fscanf(fid, ‘%f’, [2,inf]);
fclose(fid);
Window = createWindowS24(Width);
Alpha = []; % List of ball handles
for i =1:size(Coords,2)
Alpha(i) = drawBall(Coords(1,i), Coords(2, i), Radius,’g’);
end
else
% User input
Width = input(‘Please input desired width of the window: ‘);
Radius = input(‘Please input desired radius of the balls: ‘);
BallNumber = input(‘Please input the desired number of balls: ‘);
Direction = input(‘Please input the desired start position of the balls (deg): ‘);
Window = createWindowS24(Width);
Alpha = []; % List of ball handles
for i = 1:BallNumber
while true
Bravo= randi([Radius,Width – Radius]);
Charlie= randi([Radius, Width-Radius]);
% Check for overlap with existing balls
overlap = false;
for j = 1:length(Alpha)
[xc, yc] = getCenter(Alpha(j));
if norm([Bravo – xc, Charlie – yc]) < 2 * Radius
overlap = true;
break;
end
end
if ~overlap
break;
end
end
Alpha(i) = drawBall(Bravo, Charlie, Radius, ‘b’);
end
end
BallNumber = numel(Alpha);
Direction = Direction*ones(1, BallNumber);
while true
for i = 1:BallNumber
[Bravo, Charlie] = getCenter(Alpha(i));
Delta= Bravo + cosd(Direction(i));
Echo= Charlie + sind(Direction(i));
if Delta <Radius|| Delta>Width- Radius
Direction(i) = 180 – Direction(i);
end
if Echo < Radius || Echo > Width -Radius
Direction(i)=-Direction(i);
end
xMove(Alpha(i), cosd(Direction(i)));
yMove(Alpha(i), sind(Direction(i)));
end
for i = 1:BallNumber
for j = (i + 1):BallNumber
[x1, y1] = getCenter(Alpha(i));
[x2, y2] = getCenter(Alpha(j));
% Check if two balls collide
Collision = sqrt((x2-x1)^2 + (y2 – y1)^2);
if Collision <2*Radius
% Calculate the angle of collision
CAngle = atan2d(y2 – y1, x2 – x1);
% Update directions after collision (elastic collision)
Direction1=[cosd(Direction(i)), sind(Direction(i))];
Direction2 = [cosd(Direction(j)), sind(Direction(j))];
EC = [(x2-x1)/Collision,(y2-y1)/Collision];
Dir1F = Direction1 – 2*dot(Direction1, EC) * EC;
Dir2F = Direction2 – 2 * dot(Direction2, EC) * EC;
Direction(i) = atan2d(Dir1F(2),Dir1F(1));
Direction(j) = atan2d(Dir2F(2),Dir2F(1));
end
end
end
% Redraw all objects
redraw();
end
I have this quite long code for some balls that will collide with each other and the window bounds. However, I cannot seem to figure out how to make it collide with the restricted area and go through the warp gates. Any assistance would be appreciated. Below this is the function for the window, if that helps.
function f = createWindowS24(w)
close all
% createWindowall(w)
% function to create a square window whose width is w pixels and
% whose height is w pixels; its bottom left corner is placed
% 50 pixels up and 50 pixels to the right of the bottom left
% corner of the monitor
% This version of the function also generates a restricted zone in the top
% left and top right corners of the square.
% (note: the function returns a handle to the window, if needed;
% usage would then need to be f=createWindowS24(w)
left = 50;
bottom = 50;
pos = [left bottom w w];
f = figure;
set (f, ‘Position’, pos)
set (f, ‘MenuBar’, ‘none’)
set (f, ‘Name’, ‘AE 227 – Spring 2024’)
x = [0 w];
y = [0 w];
hold on
axis equal
axis ([x y])
axis off
x1=[0,w,w,0,0];
y1=[0,0,w,w,0];
fill(x1,y1,[1,1,1]); %draw the boundary
%Top Left
x2 = [0,0,w/2,0];
y2 = [w/2,w,w,w/2];
fill(x2,y2,[0.5 0.5 0.5])
%Top Right
x3 = [w/2,w,w];
y3 = [w,w,w/2];
fill(x3,y3,[0.5 0.5 0.5])
diff=0.01*w;
%Top Left Diagonal Warp
x5=[w/6,w/6-diff,w/3-diff,w/3,w/6];
y5=[2*w/3,2*w/3+diff,5*w/6+diff,5*w/6,2*w/3];
fill(x5,y5,[.6,.6,1]);
%Top Right Diagonal Warp
x5=[5*w/6,5*w/6+diff,2*w/3+diff,2*w/3,5*w/6];
y5=[2*w/3,2*w/3+diff,5*w/6+diff,5*w/6,2*w/3];
fill(x5,y5,[.6,.6,1]);clc
% Prompts user for the desired input method
Input = input(‘Type of input (User or File): ‘, ‘s’);
if strcmp(Input, ‘file’)
% File input
filename = input(‘Filename ‘, ‘s’);
fid = fopen(filename);
Width = fscanf(fid, ‘%f’,1);
Radius = fscanf(fid, ‘%f’,1);
Direction = fscanf(fid,’%f’, 1);
Coords = fscanf(fid, ‘%f’, [2,inf]);
fclose(fid);
Window = createWindowS24(Width);
Alpha = []; % List of ball handles
for i =1:size(Coords,2)
Alpha(i) = drawBall(Coords(1,i), Coords(2, i), Radius,’g’);
end
else
% User input
Width = input(‘Please input desired width of the window: ‘);
Radius = input(‘Please input desired radius of the balls: ‘);
BallNumber = input(‘Please input the desired number of balls: ‘);
Direction = input(‘Please input the desired start position of the balls (deg): ‘);
Window = createWindowS24(Width);
Alpha = []; % List of ball handles
for i = 1:BallNumber
while true
Bravo= randi([Radius,Width – Radius]);
Charlie= randi([Radius, Width-Radius]);
% Check for overlap with existing balls
overlap = false;
for j = 1:length(Alpha)
[xc, yc] = getCenter(Alpha(j));
if norm([Bravo – xc, Charlie – yc]) < 2 * Radius
overlap = true;
break;
end
end
if ~overlap
break;
end
end
Alpha(i) = drawBall(Bravo, Charlie, Radius, ‘b’);
end
end
BallNumber = numel(Alpha);
Direction = Direction*ones(1, BallNumber);
while true
for i = 1:BallNumber
[Bravo, Charlie] = getCenter(Alpha(i));
Delta= Bravo + cosd(Direction(i));
Echo= Charlie + sind(Direction(i));
if Delta <Radius|| Delta>Width- Radius
Direction(i) = 180 – Direction(i);
end
if Echo < Radius || Echo > Width -Radius
Direction(i)=-Direction(i);
end
xMove(Alpha(i), cosd(Direction(i)));
yMove(Alpha(i), sind(Direction(i)));
end
for i = 1:BallNumber
for j = (i + 1):BallNumber
[x1, y1] = getCenter(Alpha(i));
[x2, y2] = getCenter(Alpha(j));
% Check if two balls collide
Collision = sqrt((x2-x1)^2 + (y2 – y1)^2);
if Collision <2*Radius
% Calculate the angle of collision
CAngle = atan2d(y2 – y1, x2 – x1);
% Update directions after collision (elastic collision)
Direction1=[cosd(Direction(i)), sind(Direction(i))];
Direction2 = [cosd(Direction(j)), sind(Direction(j))];
EC = [(x2-x1)/Collision,(y2-y1)/Collision];
Dir1F = Direction1 – 2*dot(Direction1, EC) * EC;
Dir2F = Direction2 – 2 * dot(Direction2, EC) * EC;
Direction(i) = atan2d(Dir1F(2),Dir1F(1));
Direction(j) = atan2d(Dir2F(2),Dir2F(1));
end
end
end
% Redraw all objects
redraw();
end
I have this quite long code for some balls that will collide with each other and the window bounds. However, I cannot seem to figure out how to make it collide with the restricted area and go through the warp gates. Any assistance would be appreciated. Below this is the function for the window, if that helps.
function f = createWindowS24(w)
close all
% createWindowall(w)
% function to create a square window whose width is w pixels and
% whose height is w pixels; its bottom left corner is placed
% 50 pixels up and 50 pixels to the right of the bottom left
% corner of the monitor
% This version of the function also generates a restricted zone in the top
% left and top right corners of the square.
% (note: the function returns a handle to the window, if needed;
% usage would then need to be f=createWindowS24(w)
left = 50;
bottom = 50;
pos = [left bottom w w];
f = figure;
set (f, ‘Position’, pos)
set (f, ‘MenuBar’, ‘none’)
set (f, ‘Name’, ‘AE 227 – Spring 2024’)
x = [0 w];
y = [0 w];
hold on
axis equal
axis ([x y])
axis off
x1=[0,w,w,0,0];
y1=[0,0,w,w,0];
fill(x1,y1,[1,1,1]); %draw the boundary
%Top Left
x2 = [0,0,w/2,0];
y2 = [w/2,w,w,w/2];
fill(x2,y2,[0.5 0.5 0.5])
%Top Right
x3 = [w/2,w,w];
y3 = [w,w,w/2];
fill(x3,y3,[0.5 0.5 0.5])
diff=0.01*w;
%Top Left Diagonal Warp
x5=[w/6,w/6-diff,w/3-diff,w/3,w/6];
y5=[2*w/3,2*w/3+diff,5*w/6+diff,5*w/6,2*w/3];
fill(x5,y5,[.6,.6,1]);
%Top Right Diagonal Warp
x5=[5*w/6,5*w/6+diff,2*w/3+diff,2*w/3,5*w/6];
y5=[2*w/3,2*w/3+diff,5*w/6+diff,5*w/6,2*w/3];
fill(x5,y5,[.6,.6,1]); clc
% Prompts user for the desired input method
Input = input(‘Type of input (User or File): ‘, ‘s’);
if strcmp(Input, ‘file’)
% File input
filename = input(‘Filename ‘, ‘s’);
fid = fopen(filename);
Width = fscanf(fid, ‘%f’,1);
Radius = fscanf(fid, ‘%f’,1);
Direction = fscanf(fid,’%f’, 1);
Coords = fscanf(fid, ‘%f’, [2,inf]);
fclose(fid);
Window = createWindowS24(Width);
Alpha = []; % List of ball handles
for i =1:size(Coords,2)
Alpha(i) = drawBall(Coords(1,i), Coords(2, i), Radius,’g’);
end
else
% User input
Width = input(‘Please input desired width of the window: ‘);
Radius = input(‘Please input desired radius of the balls: ‘);
BallNumber = input(‘Please input the desired number of balls: ‘);
Direction = input(‘Please input the desired start position of the balls (deg): ‘);
Window = createWindowS24(Width);
Alpha = []; % List of ball handles
for i = 1:BallNumber
while true
Bravo= randi([Radius,Width – Radius]);
Charlie= randi([Radius, Width-Radius]);
% Check for overlap with existing balls
overlap = false;
for j = 1:length(Alpha)
[xc, yc] = getCenter(Alpha(j));
if norm([Bravo – xc, Charlie – yc]) < 2 * Radius
overlap = true;
break;
end
end
if ~overlap
break;
end
end
Alpha(i) = drawBall(Bravo, Charlie, Radius, ‘b’);
end
end
BallNumber = numel(Alpha);
Direction = Direction*ones(1, BallNumber);
while true
for i = 1:BallNumber
[Bravo, Charlie] = getCenter(Alpha(i));
Delta= Bravo + cosd(Direction(i));
Echo= Charlie + sind(Direction(i));
if Delta <Radius|| Delta>Width- Radius
Direction(i) = 180 – Direction(i);
end
if Echo < Radius || Echo > Width -Radius
Direction(i)=-Direction(i);
end
xMove(Alpha(i), cosd(Direction(i)));
yMove(Alpha(i), sind(Direction(i)));
end
for i = 1:BallNumber
for j = (i + 1):BallNumber
[x1, y1] = getCenter(Alpha(i));
[x2, y2] = getCenter(Alpha(j));
% Check if two balls collide
Collision = sqrt((x2-x1)^2 + (y2 – y1)^2);
if Collision <2*Radius
% Calculate the angle of collision
CAngle = atan2d(y2 – y1, x2 – x1);
% Update directions after collision (elastic collision)
Direction1=[cosd(Direction(i)), sind(Direction(i))];
Direction2 = [cosd(Direction(j)), sind(Direction(j))];
EC = [(x2-x1)/Collision,(y2-y1)/Collision];
Dir1F = Direction1 – 2*dot(Direction1, EC) * EC;
Dir2F = Direction2 – 2 * dot(Direction2, EC) * EC;
Direction(i) = atan2d(Dir1F(2),Dir1F(1));
Direction(j) = atan2d(Dir2F(2),Dir2F(1));
end
end
end
% Redraw all objects
redraw();
end
I have this quite long code for some balls that will collide with each other and the window bounds. However, I cannot seem to figure out how to make it collide with the restricted area and go through the warp gates. Any assistance would be appreciated. Below this is the function for the window, if that helps.
function f = createWindowS24(w)
close all
% createWindowall(w)
% function to create a square window whose width is w pixels and
% whose height is w pixels; its bottom left corner is placed
% 50 pixels up and 50 pixels to the right of the bottom left
% corner of the monitor
% This version of the function also generates a restricted zone in the top
% left and top right corners of the square.
% (note: the function returns a handle to the window, if needed;
% usage would then need to be f=createWindowS24(w)
left = 50;
bottom = 50;
pos = [left bottom w w];
f = figure;
set (f, ‘Position’, pos)
set (f, ‘MenuBar’, ‘none’)
set (f, ‘Name’, ‘AE 227 – Spring 2024’)
x = [0 w];
y = [0 w];
hold on
axis equal
axis ([x y])
axis off
x1=[0,w,w,0,0];
y1=[0,0,w,w,0];
fill(x1,y1,[1,1,1]); %draw the boundary
%Top Left
x2 = [0,0,w/2,0];
y2 = [w/2,w,w,w/2];
fill(x2,y2,[0.5 0.5 0.5])
%Top Right
x3 = [w/2,w,w];
y3 = [w,w,w/2];
fill(x3,y3,[0.5 0.5 0.5])
diff=0.01*w;
%Top Left Diagonal Warp
x5=[w/6,w/6-diff,w/3-diff,w/3,w/6];
y5=[2*w/3,2*w/3+diff,5*w/6+diff,5*w/6,2*w/3];
fill(x5,y5,[.6,.6,1]);
%Top Right Diagonal Warp
x5=[5*w/6,5*w/6+diff,2*w/3+diff,2*w/3,5*w/6];
y5=[2*w/3,2*w/3+diff,5*w/6+diff,5*w/6,2*w/3];
fill(x5,y5,[.6,.6,1]); matlab code, function MATLAB Answers — New Questions
Layer Input Expectation Doesn’t Match (Neural Network)
Creating a dlnetwork with three inputs and two outputs. The inputs are x, y, z coordinates in the form of UTMN, UTME, and height. The outputs are pressure and temperature. Data is from multiple well logs and is organized by well ID, UTMN, UTME, height, temp, and pressure.
I seperated the data into training and validation sets. Training data: train_x_array (3 feature inputs) and train_y_array (2 feature outputs). Validation: val_x_array and val_y_array.
Keep getting errors such as:
Training stopped: Error occurred
Error using trainnet
Layer ‘input’: Invalid input data. Invalid size of channel dimension. Layer expects input with channel dimension size 3
but received input with size 189.
Error in final3 (line 25)
netTrained = trainnet(train_x_array_transposed, train_y_array_transposed, net,"mse", opts);
In an effort to fix the issue, I transposed the x and y arrays for both the training and validation sets. However, I am still getting the same error. I am at a loss for how to fix the error. If I try to use the Deep Network Designer, I receive an error stating their are multiple observations. The x and y values are the same for different heights/temps/pressures from the same well. I am assuming this is were the issue arises, but I do not understand why the designer would produce a different error.
Example data (before transposing):
x y z T P
4407300 327880 2796 344.3 501
4407300 327880 2746 356.5 521
4407300 327880 2696 357 541
Where train_x would be the first 3 columns, and train_y is the last 2.
Full Code:
inputSize = 3;
hiddenLayerSize = 20;
outputSize = 2;
layers = [
featureInputLayer(inputSize)
fullyConnectedLayer(hiddenLayerSize, ‘Name’, ‘fc1’)
reluLayer(‘Name’, ‘relu1’)
fullyConnectedLayer(outputSize, ‘Name’, ‘output’)
];
net = dlnetwork(layers);
opts = trainingOptions(‘adam’, …
‘MaxEpochs’, 100, …
‘MiniBatchSize’, 64, …
‘ValidationData’, {val_x_array_transposed’, val_y_array_transposed’}, …
‘ValidationFrequency’, 10, …
‘Verbose’, true …
);
netTrained = trainnet(train_x_array_transposed, train_y_array_transposed, net,"mse", opts);
Y_pred_val = predict(netTrained, val_x_array’);Creating a dlnetwork with three inputs and two outputs. The inputs are x, y, z coordinates in the form of UTMN, UTME, and height. The outputs are pressure and temperature. Data is from multiple well logs and is organized by well ID, UTMN, UTME, height, temp, and pressure.
I seperated the data into training and validation sets. Training data: train_x_array (3 feature inputs) and train_y_array (2 feature outputs). Validation: val_x_array and val_y_array.
Keep getting errors such as:
Training stopped: Error occurred
Error using trainnet
Layer ‘input’: Invalid input data. Invalid size of channel dimension. Layer expects input with channel dimension size 3
but received input with size 189.
Error in final3 (line 25)
netTrained = trainnet(train_x_array_transposed, train_y_array_transposed, net,"mse", opts);
In an effort to fix the issue, I transposed the x and y arrays for both the training and validation sets. However, I am still getting the same error. I am at a loss for how to fix the error. If I try to use the Deep Network Designer, I receive an error stating their are multiple observations. The x and y values are the same for different heights/temps/pressures from the same well. I am assuming this is were the issue arises, but I do not understand why the designer would produce a different error.
Example data (before transposing):
x y z T P
4407300 327880 2796 344.3 501
4407300 327880 2746 356.5 521
4407300 327880 2696 357 541
Where train_x would be the first 3 columns, and train_y is the last 2.
Full Code:
inputSize = 3;
hiddenLayerSize = 20;
outputSize = 2;
layers = [
featureInputLayer(inputSize)
fullyConnectedLayer(hiddenLayerSize, ‘Name’, ‘fc1’)
reluLayer(‘Name’, ‘relu1’)
fullyConnectedLayer(outputSize, ‘Name’, ‘output’)
];
net = dlnetwork(layers);
opts = trainingOptions(‘adam’, …
‘MaxEpochs’, 100, …
‘MiniBatchSize’, 64, …
‘ValidationData’, {val_x_array_transposed’, val_y_array_transposed’}, …
‘ValidationFrequency’, 10, …
‘Verbose’, true …
);
netTrained = trainnet(train_x_array_transposed, train_y_array_transposed, net,"mse", opts);
Y_pred_val = predict(netTrained, val_x_array’); Creating a dlnetwork with three inputs and two outputs. The inputs are x, y, z coordinates in the form of UTMN, UTME, and height. The outputs are pressure and temperature. Data is from multiple well logs and is organized by well ID, UTMN, UTME, height, temp, and pressure.
I seperated the data into training and validation sets. Training data: train_x_array (3 feature inputs) and train_y_array (2 feature outputs). Validation: val_x_array and val_y_array.
Keep getting errors such as:
Training stopped: Error occurred
Error using trainnet
Layer ‘input’: Invalid input data. Invalid size of channel dimension. Layer expects input with channel dimension size 3
but received input with size 189.
Error in final3 (line 25)
netTrained = trainnet(train_x_array_transposed, train_y_array_transposed, net,"mse", opts);
In an effort to fix the issue, I transposed the x and y arrays for both the training and validation sets. However, I am still getting the same error. I am at a loss for how to fix the error. If I try to use the Deep Network Designer, I receive an error stating their are multiple observations. The x and y values are the same for different heights/temps/pressures from the same well. I am assuming this is were the issue arises, but I do not understand why the designer would produce a different error.
Example data (before transposing):
x y z T P
4407300 327880 2796 344.3 501
4407300 327880 2746 356.5 521
4407300 327880 2696 357 541
Where train_x would be the first 3 columns, and train_y is the last 2.
Full Code:
inputSize = 3;
hiddenLayerSize = 20;
outputSize = 2;
layers = [
featureInputLayer(inputSize)
fullyConnectedLayer(hiddenLayerSize, ‘Name’, ‘fc1’)
reluLayer(‘Name’, ‘relu1’)
fullyConnectedLayer(outputSize, ‘Name’, ‘output’)
];
net = dlnetwork(layers);
opts = trainingOptions(‘adam’, …
‘MaxEpochs’, 100, …
‘MiniBatchSize’, 64, …
‘ValidationData’, {val_x_array_transposed’, val_y_array_transposed’}, …
‘ValidationFrequency’, 10, …
‘Verbose’, true …
);
netTrained = trainnet(train_x_array_transposed, train_y_array_transposed, net,"mse", opts);
Y_pred_val = predict(netTrained, val_x_array’); deep network designer, neural network, multiple inputs and outputs MATLAB Answers — New Questions
If I set up the Hardware board in Hardware Implementation, can’t I turn ON the “Generate and example main program” setting in Templates?
Specific hardware was set in Configuration Parameter –> Hardware Implementation –> Hardware board.
Code Generation –> System target file was set to ert.tlc.
If you turn on "Generate an example main program" in Code Generation –> Templates –> Custom Templates,
<The ‘GenerateSampleERTMain’ model parameter is set to ‘on’, but your hardware board requires it to be set to ‘off’ . Use ‘set_param’ command to set the ‘GenerateSampleERTMain’ model parameter to ‘off.>" Error occurs.
If I set up the Hardware board in Hardware Implementation, can’t I turn ON the "Generate and example main program" setting in Templates?Specific hardware was set in Configuration Parameter –> Hardware Implementation –> Hardware board.
Code Generation –> System target file was set to ert.tlc.
If you turn on "Generate an example main program" in Code Generation –> Templates –> Custom Templates,
<The ‘GenerateSampleERTMain’ model parameter is set to ‘on’, but your hardware board requires it to be set to ‘off’ . Use ‘set_param’ command to set the ‘GenerateSampleERTMain’ model parameter to ‘off.>" Error occurs.
If I set up the Hardware board in Hardware Implementation, can’t I turn ON the "Generate and example main program" setting in Templates? Specific hardware was set in Configuration Parameter –> Hardware Implementation –> Hardware board.
Code Generation –> System target file was set to ert.tlc.
If you turn on "Generate an example main program" in Code Generation –> Templates –> Custom Templates,
<The ‘GenerateSampleERTMain’ model parameter is set to ‘on’, but your hardware board requires it to be set to ‘off’ . Use ‘set_param’ command to set the ‘GenerateSampleERTMain’ model parameter to ‘off.>" Error occurs.
If I set up the Hardware board in Hardware Implementation, can’t I turn ON the "Generate and example main program" setting in Templates? embedded coder, generate code, generatesampleertmain MATLAB Answers — New Questions
Class D amplifier simulation model with Asynchronous delta sigma modulation
Hello communitiy members,
I am trying to build a Class D amplifier simulation model, but I coundt run it. would you please me help with class d amplifier simulation model.
Thank You.Hello communitiy members,
I am trying to build a Class D amplifier simulation model, but I coundt run it. would you please me help with class d amplifier simulation model.
Thank You. Hello communitiy members,
I am trying to build a Class D amplifier simulation model, but I coundt run it. would you please me help with class d amplifier simulation model.
Thank You. class d amplfier, simulink MATLAB Answers — New Questions