Tag Archives: matlab
GridLayout can not constrain Panel and Tab Group in the new App Designer
Design View
Running
The App works well in R2023b. The new app designer seems failed to constrain Panel and Tab Group when it is placed in a Weighted grid (1x,….). With Fixed grid, the panel can display well.Design View
Running
The App works well in R2023b. The new app designer seems failed to constrain Panel and Tab Group when it is placed in a Weighted grid (1x,….). With Fixed grid, the panel can display well. Design View
Running
The App works well in R2023b. The new app designer seems failed to constrain Panel and Tab Group when it is placed in a Weighted grid (1x,….). With Fixed grid, the panel can display well. gridlayout, appdesigner MATLAB Answers — New Questions
About SLAM initial Pose data
I am the following site
https://jp.mathworks.com/help/vision/ug/stereo-visual-simultaneous-localization-mapping.html
I would like to run SLAM on my stereo camera as a reference. I was able to record the left and right video with my stereo camera to inspect the first pair of images and get "stereo Params" from exporting the parameters of the stereo camera calibration app.
However, in the example of the above site, the initial camera pose is loaded from "’initialPose.mat’" and used as the function "initialPose". What should I prepare to do these on my camera device?I am the following site
https://jp.mathworks.com/help/vision/ug/stereo-visual-simultaneous-localization-mapping.html
I would like to run SLAM on my stereo camera as a reference. I was able to record the left and right video with my stereo camera to inspect the first pair of images and get "stereo Params" from exporting the parameters of the stereo camera calibration app.
However, in the example of the above site, the initial camera pose is loaded from "’initialPose.mat’" and used as the function "initialPose". What should I prepare to do these on my camera device? I am the following site
https://jp.mathworks.com/help/vision/ug/stereo-visual-simultaneous-localization-mapping.html
I would like to run SLAM on my stereo camera as a reference. I was able to record the left and right video with my stereo camera to inspect the first pair of images and get "stereo Params" from exporting the parameters of the stereo camera calibration app.
However, in the example of the above site, the initial camera pose is loaded from "’initialPose.mat’" and used as the function "initialPose". What should I prepare to do these on my camera device? slam, stereo, camera MATLAB Answers — New Questions
how to calculate singular values in collin test to detect multicollinearity
I am a bit confused as to how we find the singular values and therefore condition index number to detect multicollinearity in multiple linear regression analysis. Some mathematicians say the singular values are the square roots of the eigenvalues of the correlation matrix of the predictors of a model. While others says we use covariance matrix instead. Again some math publications said The singular values are the square roots of the eigenvalues of the square matrix X’X of multiple linear regression model. Then I treid using all three methods but when I cross checked with MATLAB results using collintest it does not match with either of my calculations. it does not explain how we go the output. can someone explain it to me?I am a bit confused as to how we find the singular values and therefore condition index number to detect multicollinearity in multiple linear regression analysis. Some mathematicians say the singular values are the square roots of the eigenvalues of the correlation matrix of the predictors of a model. While others says we use covariance matrix instead. Again some math publications said The singular values are the square roots of the eigenvalues of the square matrix X’X of multiple linear regression model. Then I treid using all three methods but when I cross checked with MATLAB results using collintest it does not match with either of my calculations. it does not explain how we go the output. can someone explain it to me? I am a bit confused as to how we find the singular values and therefore condition index number to detect multicollinearity in multiple linear regression analysis. Some mathematicians say the singular values are the square roots of the eigenvalues of the correlation matrix of the predictors of a model. While others says we use covariance matrix instead. Again some math publications said The singular values are the square roots of the eigenvalues of the square matrix X’X of multiple linear regression model. Then I treid using all three methods but when I cross checked with MATLAB results using collintest it does not match with either of my calculations. it does not explain how we go the output. can someone explain it to me? collintest single value decomposition MATLAB Answers — New Questions
MATLAB FUNDAMENTALS 11.4 Issue with y-data in MATLAB plot not being correct
I am encountering an issue with the y-data in a MATLAB plot not being correct. Here are the steps to reproduce the issue:
Load the data from movies.txt and releaseDates.txt using readtable.
Modify the variable names in the release table.
Ensure the Title variable in the release table matches the Title variable in the movies table.
Join the two tables using the Title variable as the key.
Convert the ReleaseDate to datetime format.
Sort the movies table by ReleaseDate in ascending order.
Plot AdjustedGross against ReleaseDate.I have confirmed there are no missing values in the AdjustedGross column and that the data types for ReleaseDate and AdjustedGross are correct. The plot is still not displaying the y-data as expected.
here is the code
This code sets up the activity.
movies = readtable("movies.txt","TextType","string");
release = readtable("releaseDates.txt","TextType","string");
movies
release.Properties.VariableNames(1) = "Title"
release.Properties.VariableNames(2) = "ReleaseDate"
release.Title = movies.Title
movies = join(movies, release, ‘Keys’, ‘Title’);
Task 1
movies = sortrows(movies,"ReleaseDate","ascend")
disp(movies.AdjustedGross)
plot(movies.ReleaseDate, movies.AdjustedGross,"-");
xlabel(‘Release Date’);
ylabel(‘Adjusted Gross Revenue’);
title(‘Adjusted Gross Revenue vs. Release Date’);I am encountering an issue with the y-data in a MATLAB plot not being correct. Here are the steps to reproduce the issue:
Load the data from movies.txt and releaseDates.txt using readtable.
Modify the variable names in the release table.
Ensure the Title variable in the release table matches the Title variable in the movies table.
Join the two tables using the Title variable as the key.
Convert the ReleaseDate to datetime format.
Sort the movies table by ReleaseDate in ascending order.
Plot AdjustedGross against ReleaseDate.I have confirmed there are no missing values in the AdjustedGross column and that the data types for ReleaseDate and AdjustedGross are correct. The plot is still not displaying the y-data as expected.
here is the code
This code sets up the activity.
movies = readtable("movies.txt","TextType","string");
release = readtable("releaseDates.txt","TextType","string");
movies
release.Properties.VariableNames(1) = "Title"
release.Properties.VariableNames(2) = "ReleaseDate"
release.Title = movies.Title
movies = join(movies, release, ‘Keys’, ‘Title’);
Task 1
movies = sortrows(movies,"ReleaseDate","ascend")
disp(movies.AdjustedGross)
plot(movies.ReleaseDate, movies.AdjustedGross,"-");
xlabel(‘Release Date’);
ylabel(‘Adjusted Gross Revenue’);
title(‘Adjusted Gross Revenue vs. Release Date’); I am encountering an issue with the y-data in a MATLAB plot not being correct. Here are the steps to reproduce the issue:
Load the data from movies.txt and releaseDates.txt using readtable.
Modify the variable names in the release table.
Ensure the Title variable in the release table matches the Title variable in the movies table.
Join the two tables using the Title variable as the key.
Convert the ReleaseDate to datetime format.
Sort the movies table by ReleaseDate in ascending order.
Plot AdjustedGross against ReleaseDate.I have confirmed there are no missing values in the AdjustedGross column and that the data types for ReleaseDate and AdjustedGross are correct. The plot is still not displaying the y-data as expected.
here is the code
This code sets up the activity.
movies = readtable("movies.txt","TextType","string");
release = readtable("releaseDates.txt","TextType","string");
movies
release.Properties.VariableNames(1) = "Title"
release.Properties.VariableNames(2) = "ReleaseDate"
release.Title = movies.Title
movies = join(movies, release, ‘Keys’, ‘Title’);
Task 1
movies = sortrows(movies,"ReleaseDate","ascend")
disp(movies.AdjustedGross)
plot(movies.ReleaseDate, movies.AdjustedGross,"-");
xlabel(‘Release Date’);
ylabel(‘Adjusted Gross Revenue’);
title(‘Adjusted Gross Revenue vs. Release Date’); matlab, fundamentals, issue, wrong answer MATLAB Answers — New Questions
Temporarily Change Signal Line Names in Simulink
I have a simulink model, the signal line names are currently hand typed. However, all the signal names are also in a seperate excel spreadsheet. The signal names in the spreadhseet change every now and then, and I want the model to automatically reflect that. I want to replace the signal names with a marker, lets say @excelsheetname:linenumber. I know I can grab all the signal names in matlab, then I can import the spreadsheet and replace the marker with the proper name, but how do I maintain the marker, so the next time the model is opened, it can grab the correct signal names again whether they have changed or not?I have a simulink model, the signal line names are currently hand typed. However, all the signal names are also in a seperate excel spreadsheet. The signal names in the spreadhseet change every now and then, and I want the model to automatically reflect that. I want to replace the signal names with a marker, lets say @excelsheetname:linenumber. I know I can grab all the signal names in matlab, then I can import the spreadsheet and replace the marker with the proper name, but how do I maintain the marker, so the next time the model is opened, it can grab the correct signal names again whether they have changed or not? I have a simulink model, the signal line names are currently hand typed. However, all the signal names are also in a seperate excel spreadsheet. The signal names in the spreadhseet change every now and then, and I want the model to automatically reflect that. I want to replace the signal names with a marker, lets say @excelsheetname:linenumber. I know I can grab all the signal names in matlab, then I can import the spreadsheet and replace the marker with the proper name, but how do I maintain the marker, so the next time the model is opened, it can grab the correct signal names again whether they have changed or not? simulink, signal processing MATLAB Answers — New Questions
Why Matlab can not find the WSL2?
I am using a toolbox called uav toolbox support package for px4 autopilot, once I click the gear icon for set up, the image below would show up:
it means I have to install WSL2, but actually, I had installed WSL2, it just can not find the WSL2.
I am also find the answer that I should change the display language to English and delete some files, but unfortunately, my Windows11 is a single language version, so I can not change the language to English. I need another solution.
How can I get Matlab find the WSL2 on my PC?(there is one, I am sure)
Thanks for your answers.I am using a toolbox called uav toolbox support package for px4 autopilot, once I click the gear icon for set up, the image below would show up:
it means I have to install WSL2, but actually, I had installed WSL2, it just can not find the WSL2.
I am also find the answer that I should change the display language to English and delete some files, but unfortunately, my Windows11 is a single language version, so I can not change the language to English. I need another solution.
How can I get Matlab find the WSL2 on my PC?(there is one, I am sure)
Thanks for your answers. I am using a toolbox called uav toolbox support package for px4 autopilot, once I click the gear icon for set up, the image below would show up:
it means I have to install WSL2, but actually, I had installed WSL2, it just can not find the WSL2.
I am also find the answer that I should change the display language to English and delete some files, but unfortunately, my Windows11 is a single language version, so I can not change the language to English. I need another solution.
How can I get Matlab find the WSL2 on my PC?(there is one, I am sure)
Thanks for your answers. wsl2, uav toolbox MATLAB Answers — New Questions
How can I establish communication with a Speedgoat target computer via an Ethernet interface configured as ‘Public’?
I am using Simulink Real-Time (SLRT) with a Speedgoat target computer. I need to configure the Windows Defender Firewall on my host PC to allow communication with the target. I have followed the steps provided in this link:
https://www.mathworks.com/matlabcentral/answers/396086-how-do-i-configure-windows-defender-firewall-for-matlab-to-communicate-with-external-hardware-such-a
The Ethernet interface on my host PC, which is used for the host-target link, is configured as ‘Public’ according to the Windows Network and Sharing Center:
This means that any changes or rules I apply to the Windows Defender Firewall should be specific to ‘Public’ networks in order to take effect on the host-target link. However, due to my organization’s IT policies, the options for ‘Public’ networks are grayed out when I try to allow MATLAB through the Windows Defender Firewall.
Consequently, I can perform a Speedgoat software update successfully, but I am unable to establish an actual connection to the target using MATLAB R2020b or later. I errors such as the following:
Cannot connect to target ‘TargetPC1’: Cannot connect to target.
or
Unable to connect to target computer ‘TargetPC1’: Unable to connect to target computer.I am using Simulink Real-Time (SLRT) with a Speedgoat target computer. I need to configure the Windows Defender Firewall on my host PC to allow communication with the target. I have followed the steps provided in this link:
https://www.mathworks.com/matlabcentral/answers/396086-how-do-i-configure-windows-defender-firewall-for-matlab-to-communicate-with-external-hardware-such-a
The Ethernet interface on my host PC, which is used for the host-target link, is configured as ‘Public’ according to the Windows Network and Sharing Center:
This means that any changes or rules I apply to the Windows Defender Firewall should be specific to ‘Public’ networks in order to take effect on the host-target link. However, due to my organization’s IT policies, the options for ‘Public’ networks are grayed out when I try to allow MATLAB through the Windows Defender Firewall.
Consequently, I can perform a Speedgoat software update successfully, but I am unable to establish an actual connection to the target using MATLAB R2020b or later. I errors such as the following:
Cannot connect to target ‘TargetPC1’: Cannot connect to target.
or
Unable to connect to target computer ‘TargetPC1’: Unable to connect to target computer. I am using Simulink Real-Time (SLRT) with a Speedgoat target computer. I need to configure the Windows Defender Firewall on my host PC to allow communication with the target. I have followed the steps provided in this link:
https://www.mathworks.com/matlabcentral/answers/396086-how-do-i-configure-windows-defender-firewall-for-matlab-to-communicate-with-external-hardware-such-a
The Ethernet interface on my host PC, which is used for the host-target link, is configured as ‘Public’ according to the Windows Network and Sharing Center:
This means that any changes or rules I apply to the Windows Defender Firewall should be specific to ‘Public’ networks in order to take effect on the host-target link. However, due to my organization’s IT policies, the options for ‘Public’ networks are grayed out when I try to allow MATLAB through the Windows Defender Firewall.
Consequently, I can perform a Speedgoat software update successfully, but I am unable to establish an actual connection to the target using MATLAB R2020b or later. I errors such as the following:
Cannot connect to target ‘TargetPC1’: Cannot connect to target.
or
Unable to connect to target computer ‘TargetPC1’: Unable to connect to target computer. windows, firewall, speedgoat, slrt, netconnectionprofile, networkcategory MATLAB Answers — New Questions
Style Property Not Being Recognised
Hi all,
I am trying to format a table – border, border colour etc. I am trying to do this programmatically from the Mathwoks page here: https://uk.mathworks.com/help/rptgen/ug/format-tables.html#mw_aa27b9a4-0c98-4bd7-a08d-2bfa3dda0411
However, I keep getting a error saying "The class table has no Constant property or Static method named ‘Style’."
From the web page I would input something like this:
table.Style = [table.Style {Border(‘solid’,’black’,’3px’)}]
But the above error message is being shown.
Here is my code. I am only interested in formatting the table, so sorry for so much code.
%Structural Properties
E = 2.1E+08;
Ic1 = 22530/100^4;
Ic2 = 14270/100^4;
Ic3 = 5259/100^4;
Ib = 16040/100^4;
Ac1 = 168/100^2;
Ac2 = 113.3/100^2;
Ac3 = 66.28/100^2;
H = 21;
h = 3;
w = 12.7;
% Average second moment of area of coluums
Ic = (2*Ic1 + 2*Ic2 + 3*Ic2)/7
% Average cross-sectional area of columns
Ac = (2*Ac1 + 2*Ac2 + 3*Ac3)/7
% Stiffness of columns of bracing unit 1
Kc1 = 4*12*E*Ic/h^2
% Stiffness of beams
Kb1 = 2*12*E*Ib/(9*h) + 12*E*Ib/(2*h)
% Reduction factor
r1 = Kc1/(Kb1+Kc1)
% Stiffness of one sub-frame
K1 = (1/Kc1 + 1/Kb1)^-1
% Global second moment of area
Ig1 = 2*Ac*1^2 + 2*Ac*10^2
% Second moment of area of one column
I1 = 4*r1*Ic
% Total second moment of area for bending stiffness
If1 = I1 + Ig1
% Parameter kappa
kappa1 = sqrt(K1/(E*I1))
% Parameter kappa*H
kappaH1 = kappa1*H
% deflection due to shear
ys1 = w*H^2/(2*K1)
% deflection due to bending
yb1 = w*H^4/(8*E*If1)
% Deflection due to interaction of shear and bending
yr1 = (w*E*I1)/(K1^2)*(1 + kappaH1*sinh(kappaH1)/(cosh(kappaH1)-1))
% Total deflection
y1 = ys1 + yb1 – yr1
Bracing_Unit1 = [Kc1 Kb1 K1 Ig1 ys1 yb1 yr1 y1]’
Bracing_Unit2 = [Kc1 Kb1 K1 Ig1 ys1 yb1 yr1 y1]’
Core_1 = [Kc1 Kb1 K1 Ig1 ys1 yb1 yr1 y1]’
Core_2 = [Kc1 Kb1 K1 Ig1 ys1 yb1 yr1 y1]’
% Set up table
Labels = {‘Column Stiffness’,’Beam Stiffness’,’Frame Stiffness’,’Global Second moment of Area’,’Shear Deflection’,’Bending Deflection’,’Shear/Bending Interaction’,’Total Deflection’};
T = table(Bracing_Unit1,Bracing_Unit2,Core_1,Core_2,’RowNames’,Labels)
table.Style = [table.Style {Border(‘solid’,’black’,’3px’)}]
Can someone help please?
Many thanks,
ScottHi all,
I am trying to format a table – border, border colour etc. I am trying to do this programmatically from the Mathwoks page here: https://uk.mathworks.com/help/rptgen/ug/format-tables.html#mw_aa27b9a4-0c98-4bd7-a08d-2bfa3dda0411
However, I keep getting a error saying "The class table has no Constant property or Static method named ‘Style’."
From the web page I would input something like this:
table.Style = [table.Style {Border(‘solid’,’black’,’3px’)}]
But the above error message is being shown.
Here is my code. I am only interested in formatting the table, so sorry for so much code.
%Structural Properties
E = 2.1E+08;
Ic1 = 22530/100^4;
Ic2 = 14270/100^4;
Ic3 = 5259/100^4;
Ib = 16040/100^4;
Ac1 = 168/100^2;
Ac2 = 113.3/100^2;
Ac3 = 66.28/100^2;
H = 21;
h = 3;
w = 12.7;
% Average second moment of area of coluums
Ic = (2*Ic1 + 2*Ic2 + 3*Ic2)/7
% Average cross-sectional area of columns
Ac = (2*Ac1 + 2*Ac2 + 3*Ac3)/7
% Stiffness of columns of bracing unit 1
Kc1 = 4*12*E*Ic/h^2
% Stiffness of beams
Kb1 = 2*12*E*Ib/(9*h) + 12*E*Ib/(2*h)
% Reduction factor
r1 = Kc1/(Kb1+Kc1)
% Stiffness of one sub-frame
K1 = (1/Kc1 + 1/Kb1)^-1
% Global second moment of area
Ig1 = 2*Ac*1^2 + 2*Ac*10^2
% Second moment of area of one column
I1 = 4*r1*Ic
% Total second moment of area for bending stiffness
If1 = I1 + Ig1
% Parameter kappa
kappa1 = sqrt(K1/(E*I1))
% Parameter kappa*H
kappaH1 = kappa1*H
% deflection due to shear
ys1 = w*H^2/(2*K1)
% deflection due to bending
yb1 = w*H^4/(8*E*If1)
% Deflection due to interaction of shear and bending
yr1 = (w*E*I1)/(K1^2)*(1 + kappaH1*sinh(kappaH1)/(cosh(kappaH1)-1))
% Total deflection
y1 = ys1 + yb1 – yr1
Bracing_Unit1 = [Kc1 Kb1 K1 Ig1 ys1 yb1 yr1 y1]’
Bracing_Unit2 = [Kc1 Kb1 K1 Ig1 ys1 yb1 yr1 y1]’
Core_1 = [Kc1 Kb1 K1 Ig1 ys1 yb1 yr1 y1]’
Core_2 = [Kc1 Kb1 K1 Ig1 ys1 yb1 yr1 y1]’
% Set up table
Labels = {‘Column Stiffness’,’Beam Stiffness’,’Frame Stiffness’,’Global Second moment of Area’,’Shear Deflection’,’Bending Deflection’,’Shear/Bending Interaction’,’Total Deflection’};
T = table(Bracing_Unit1,Bracing_Unit2,Core_1,Core_2,’RowNames’,Labels)
table.Style = [table.Style {Border(‘solid’,’black’,’3px’)}]
Can someone help please?
Many thanks,
Scott Hi all,
I am trying to format a table – border, border colour etc. I am trying to do this programmatically from the Mathwoks page here: https://uk.mathworks.com/help/rptgen/ug/format-tables.html#mw_aa27b9a4-0c98-4bd7-a08d-2bfa3dda0411
However, I keep getting a error saying "The class table has no Constant property or Static method named ‘Style’."
From the web page I would input something like this:
table.Style = [table.Style {Border(‘solid’,’black’,’3px’)}]
But the above error message is being shown.
Here is my code. I am only interested in formatting the table, so sorry for so much code.
%Structural Properties
E = 2.1E+08;
Ic1 = 22530/100^4;
Ic2 = 14270/100^4;
Ic3 = 5259/100^4;
Ib = 16040/100^4;
Ac1 = 168/100^2;
Ac2 = 113.3/100^2;
Ac3 = 66.28/100^2;
H = 21;
h = 3;
w = 12.7;
% Average second moment of area of coluums
Ic = (2*Ic1 + 2*Ic2 + 3*Ic2)/7
% Average cross-sectional area of columns
Ac = (2*Ac1 + 2*Ac2 + 3*Ac3)/7
% Stiffness of columns of bracing unit 1
Kc1 = 4*12*E*Ic/h^2
% Stiffness of beams
Kb1 = 2*12*E*Ib/(9*h) + 12*E*Ib/(2*h)
% Reduction factor
r1 = Kc1/(Kb1+Kc1)
% Stiffness of one sub-frame
K1 = (1/Kc1 + 1/Kb1)^-1
% Global second moment of area
Ig1 = 2*Ac*1^2 + 2*Ac*10^2
% Second moment of area of one column
I1 = 4*r1*Ic
% Total second moment of area for bending stiffness
If1 = I1 + Ig1
% Parameter kappa
kappa1 = sqrt(K1/(E*I1))
% Parameter kappa*H
kappaH1 = kappa1*H
% deflection due to shear
ys1 = w*H^2/(2*K1)
% deflection due to bending
yb1 = w*H^4/(8*E*If1)
% Deflection due to interaction of shear and bending
yr1 = (w*E*I1)/(K1^2)*(1 + kappaH1*sinh(kappaH1)/(cosh(kappaH1)-1))
% Total deflection
y1 = ys1 + yb1 – yr1
Bracing_Unit1 = [Kc1 Kb1 K1 Ig1 ys1 yb1 yr1 y1]’
Bracing_Unit2 = [Kc1 Kb1 K1 Ig1 ys1 yb1 yr1 y1]’
Core_1 = [Kc1 Kb1 K1 Ig1 ys1 yb1 yr1 y1]’
Core_2 = [Kc1 Kb1 K1 Ig1 ys1 yb1 yr1 y1]’
% Set up table
Labels = {‘Column Stiffness’,’Beam Stiffness’,’Frame Stiffness’,’Global Second moment of Area’,’Shear Deflection’,’Bending Deflection’,’Shear/Bending Interaction’,’Total Deflection’};
T = table(Bracing_Unit1,Bracing_Unit2,Core_1,Core_2,’RowNames’,Labels)
table.Style = [table.Style {Border(‘solid’,’black’,’3px’)}]
Can someone help please?
Many thanks,
Scott formatting table error message MATLAB Answers — New Questions
How to incorporate scatter function so that the lines of the image don’t print on top of one another
I have this code to take x.y,z coordinates to make an x-ray image. The lines of the image just print on top of one another. I want to use the scatter function so that the lines of the image make a full picture. How and where would I add this?
Here is my code:
data = readmatrix(‘C:UsersdevinehChest_XRay_Raw_Data.txt’);
% Extract x, y, z coordinates and grayscale values
x = data(:,1);
y = data(:,2);
z = data(:,3); % If needed, otherwise ignore
grayscale = data(:,4);
%Normalize points
x = round(x – min(x) + 1);
y = round(y – min(y) + 1);
%Find bounds
x_range = min(x):max(x);
y_range = min(y):max(y);
% Initialize the image matrix
image = zeros(length(y_range), length(x_range));
% Populate the image matrix with grayscale values
for i = 1:length(x)
x_idx = find(x_range == x(i));
y_idx = find(y_range == y(i));
image(y_idx, x_idx) = grayscale(i);
end
%normalize image
image = mat2gray(image);
% Display the image
imshow(image);
title(‘Reconstructed Image from Raw Data’);I have this code to take x.y,z coordinates to make an x-ray image. The lines of the image just print on top of one another. I want to use the scatter function so that the lines of the image make a full picture. How and where would I add this?
Here is my code:
data = readmatrix(‘C:UsersdevinehChest_XRay_Raw_Data.txt’);
% Extract x, y, z coordinates and grayscale values
x = data(:,1);
y = data(:,2);
z = data(:,3); % If needed, otherwise ignore
grayscale = data(:,4);
%Normalize points
x = round(x – min(x) + 1);
y = round(y – min(y) + 1);
%Find bounds
x_range = min(x):max(x);
y_range = min(y):max(y);
% Initialize the image matrix
image = zeros(length(y_range), length(x_range));
% Populate the image matrix with grayscale values
for i = 1:length(x)
x_idx = find(x_range == x(i));
y_idx = find(y_range == y(i));
image(y_idx, x_idx) = grayscale(i);
end
%normalize image
image = mat2gray(image);
% Display the image
imshow(image);
title(‘Reconstructed Image from Raw Data’); I have this code to take x.y,z coordinates to make an x-ray image. The lines of the image just print on top of one another. I want to use the scatter function so that the lines of the image make a full picture. How and where would I add this?
Here is my code:
data = readmatrix(‘C:UsersdevinehChest_XRay_Raw_Data.txt’);
% Extract x, y, z coordinates and grayscale values
x = data(:,1);
y = data(:,2);
z = data(:,3); % If needed, otherwise ignore
grayscale = data(:,4);
%Normalize points
x = round(x – min(x) + 1);
y = round(y – min(y) + 1);
%Find bounds
x_range = min(x):max(x);
y_range = min(y):max(y);
% Initialize the image matrix
image = zeros(length(y_range), length(x_range));
% Populate the image matrix with grayscale values
for i = 1:length(x)
x_idx = find(x_range == x(i));
y_idx = find(y_range == y(i));
image(y_idx, x_idx) = grayscale(i);
end
%normalize image
image = mat2gray(image);
% Display the image
imshow(image);
title(‘Reconstructed Image from Raw Data’); scatter, grayscale, image MATLAB Answers — New Questions
Why am I receiving an error stating that libicuuc.so.67 is missing from MATLAB or its installer?
Why am I receiving an error stating that libicuuc.so.67 is missing from MATLAB or its installer?Why am I receiving an error stating that libicuuc.so.67 is missing from MATLAB or its installer? Why am I receiving an error stating that libicuuc.so.67 is missing from MATLAB or its installer? MATLAB Answers — New Questions
Read names of files listed as entries in an excel file and run those files using a loop
I am trying to create a script that reads an excel file that has a column of names of .dat files that I want to process in matlab. I am having issues getting the script to read text entries in the excel file and having the script run those files. I know its a type issue, but I am not sure how to fix it.
This is my relevant code:
file_contents = readmatrix(‘testing_summary(Sheet1).csv’)
file_names = file_contents(1:12,3) % stores the names of the files
for i = 1:13(file_names)
fid = fopen(file_names(i));
fclose(fid); % Close the file when done
endI am trying to create a script that reads an excel file that has a column of names of .dat files that I want to process in matlab. I am having issues getting the script to read text entries in the excel file and having the script run those files. I know its a type issue, but I am not sure how to fix it.
This is my relevant code:
file_contents = readmatrix(‘testing_summary(Sheet1).csv’)
file_names = file_contents(1:12,3) % stores the names of the files
for i = 1:13(file_names)
fid = fopen(file_names(i));
fclose(fid); % Close the file when done
end I am trying to create a script that reads an excel file that has a column of names of .dat files that I want to process in matlab. I am having issues getting the script to read text entries in the excel file and having the script run those files. I know its a type issue, but I am not sure how to fix it.
This is my relevant code:
file_contents = readmatrix(‘testing_summary(Sheet1).csv’)
file_names = file_contents(1:12,3) % stores the names of the files
for i = 1:13(file_names)
fid = fopen(file_names(i));
fclose(fid); % Close the file when done
end read text entries in excel, run several files using a for loop MATLAB Answers — New Questions
Live CAN message from Simulink to App Designer
Hi all,
I am having issue with both Simulink and App designer due to Arduino Hardware limitation.
So my new approach is to read live CAN message via Simulink and bring that data to App designer.
I was able to run the simulation but it is running as just ‘start’ not ‘monitor and tune’ by using this code
set_param(app.ModelName,’SimulationCommand’,’Start’)
Is there a way to programatically run ‘monitor and tune’ so I can run simulink via App Designer on Arduino?
Thanks!Hi all,
I am having issue with both Simulink and App designer due to Arduino Hardware limitation.
So my new approach is to read live CAN message via Simulink and bring that data to App designer.
I was able to run the simulation but it is running as just ‘start’ not ‘monitor and tune’ by using this code
set_param(app.ModelName,’SimulationCommand’,’Start’)
Is there a way to programatically run ‘monitor and tune’ so I can run simulink via App Designer on Arduino?
Thanks! Hi all,
I am having issue with both Simulink and App designer due to Arduino Hardware limitation.
So my new approach is to read live CAN message via Simulink and bring that data to App designer.
I was able to run the simulation but it is running as just ‘start’ not ‘monitor and tune’ by using this code
set_param(app.ModelName,’SimulationCommand’,’Start’)
Is there a way to programatically run ‘monitor and tune’ so I can run simulink via App Designer on Arduino?
Thanks! arduino, simulink, app designer, canbus MATLAB Answers — New Questions
MCC USB-231 compatibility with Simulink
Hello, I am trying to use the data acquisition toolbox to use my USB-231 DAQ inside of my Simulink model. The DAQ shows up inside of MATLAB and I am able to read and write, but inside of Simulink I am unable to access the board from the Data acquisition toolbox’s Analog Input/Output. Is there any troubleshooting I can do to get my board to show up or is there some other workaround I need to get it to work in Simulink. Thank you for any help you can give me.Hello, I am trying to use the data acquisition toolbox to use my USB-231 DAQ inside of my Simulink model. The DAQ shows up inside of MATLAB and I am able to read and write, but inside of Simulink I am unable to access the board from the Data acquisition toolbox’s Analog Input/Output. Is there any troubleshooting I can do to get my board to show up or is there some other workaround I need to get it to work in Simulink. Thank you for any help you can give me. Hello, I am trying to use the data acquisition toolbox to use my USB-231 DAQ inside of my Simulink model. The DAQ shows up inside of MATLAB and I am able to read and write, but inside of Simulink I am unable to access the board from the Data acquisition toolbox’s Analog Input/Output. Is there any troubleshooting I can do to get my board to show up or is there some other workaround I need to get it to work in Simulink. Thank you for any help you can give me. daq, simulink, data acquisition MATLAB Answers — New Questions
Adding exogenous input to iddata (to expand an ARMAX model)
Extended ARMAX model:
A(q)y(k)=B(q)u(k)+C(q)e(t)+D(q)w(t)
w(t) is not an input, in the sense that I don’t have control over it. But I can meassure the value, and I want to refine the model with it, since I’m certain that it has an influence on the output y(t).
Therefore I thought of regarding it as an exogenous input to the model.
how can I expand the data-set to a MISO system with the additional ex. input. w(t) in MATLAB?
So far I have done the following (of course, it is oversimplified here):
y = cell(1,N_Experiments);
u = cell(1,N_Experiments);
u_exogenous = cell(1,N_Experiments);
period = cell(1,N_Experiments);
for i = 1:N_Experiments
[y{i},u{i},u_exogenous{i},period{i}] = simulate_system();
end
data = iddata(y,[u,u_exogenous],period);
orders = get_orders(data);
arx_sys = arx(data,orders);
where "get_orders" is a function that guesses the orders with "selstruc" and other MATLAB functions designed for this.
*Question(s)* :
* Is this a valid approach to consider exogenous inputs in a model?
* Do the _System Identification Toolbox_ functions (e.g. "iddata", "armax", etc) recognize "u_exogenous" as what it is?
As for now, the above script works without errors (iddata admits MISO systems). But there is *no performance improvement* (fit with the "compare" function, MSE,etc) from adding the exogenous input, which contradicts all theory and intuition, so I’m not sure if "u_exogenous" is recognized properly with this approach.Extended ARMAX model:
A(q)y(k)=B(q)u(k)+C(q)e(t)+D(q)w(t)
w(t) is not an input, in the sense that I don’t have control over it. But I can meassure the value, and I want to refine the model with it, since I’m certain that it has an influence on the output y(t).
Therefore I thought of regarding it as an exogenous input to the model.
how can I expand the data-set to a MISO system with the additional ex. input. w(t) in MATLAB?
So far I have done the following (of course, it is oversimplified here):
y = cell(1,N_Experiments);
u = cell(1,N_Experiments);
u_exogenous = cell(1,N_Experiments);
period = cell(1,N_Experiments);
for i = 1:N_Experiments
[y{i},u{i},u_exogenous{i},period{i}] = simulate_system();
end
data = iddata(y,[u,u_exogenous],period);
orders = get_orders(data);
arx_sys = arx(data,orders);
where "get_orders" is a function that guesses the orders with "selstruc" and other MATLAB functions designed for this.
*Question(s)* :
* Is this a valid approach to consider exogenous inputs in a model?
* Do the _System Identification Toolbox_ functions (e.g. "iddata", "armax", etc) recognize "u_exogenous" as what it is?
As for now, the above script works without errors (iddata admits MISO systems). But there is *no performance improvement* (fit with the "compare" function, MSE,etc) from adding the exogenous input, which contradicts all theory and intuition, so I’m not sure if "u_exogenous" is recognized properly with this approach. Extended ARMAX model:
A(q)y(k)=B(q)u(k)+C(q)e(t)+D(q)w(t)
w(t) is not an input, in the sense that I don’t have control over it. But I can meassure the value, and I want to refine the model with it, since I’m certain that it has an influence on the output y(t).
Therefore I thought of regarding it as an exogenous input to the model.
how can I expand the data-set to a MISO system with the additional ex. input. w(t) in MATLAB?
So far I have done the following (of course, it is oversimplified here):
y = cell(1,N_Experiments);
u = cell(1,N_Experiments);
u_exogenous = cell(1,N_Experiments);
period = cell(1,N_Experiments);
for i = 1:N_Experiments
[y{i},u{i},u_exogenous{i},period{i}] = simulate_system();
end
data = iddata(y,[u,u_exogenous],period);
orders = get_orders(data);
arx_sys = arx(data,orders);
where "get_orders" is a function that guesses the orders with "selstruc" and other MATLAB functions designed for this.
*Question(s)* :
* Is this a valid approach to consider exogenous inputs in a model?
* Do the _System Identification Toolbox_ functions (e.g. "iddata", "armax", etc) recognize "u_exogenous" as what it is?
As for now, the above script works without errors (iddata admits MISO systems). But there is *no performance improvement* (fit with the "compare" function, MSE,etc) from adding the exogenous input, which contradicts all theory and intuition, so I’m not sure if "u_exogenous" is recognized properly with this approach. data, model, time series, armax, input MATLAB Answers — New Questions
Calculation Value at Risk in Matlab
Write a code in Matlab
Calculate Value at risk using Historical simulation and variance covariance method with garch volatility to forecast on Nifty50, Ftse 100 and S&P 500Write a code in Matlab
Calculate Value at risk using Historical simulation and variance covariance method with garch volatility to forecast on Nifty50, Ftse 100 and S&P 500 Write a code in Matlab
Calculate Value at risk using Historical simulation and variance covariance method with garch volatility to forecast on Nifty50, Ftse 100 and S&P 500 methods- historical simulation and variance covari MATLAB Answers — New Questions
Why does the silent installer fail with the error “No products are selected. The product lines specified in the input file are invalid”?
When performing a silent installation, why does the silent installer fail with the error "No products are selected. The product lines specified in the input file are invalid"?When performing a silent installation, why does the silent installer fail with the error "No products are selected. The product lines specified in the input file are invalid"? When performing a silent installation, why does the silent installer fail with the error "No products are selected. The product lines specified in the input file are invalid"? MATLAB Answers — New Questions
legend symbol disappears when plotting a polyshape
If there is not any output from the legend, the symbol of the polyshape is visible:
p=plot(polyshape([0 0 1 1],[1 0 0 1]));
legend(p);
Instead, if I try to get both outputs of the legend with a polyshape, the symbol of the polyshape disappears:
p=plot(polyshape([0 0 1 1],[1 0 0 1]));
[h,objh]=legend(p);
How can I still see/visualise the symbol of the polyshape, when I need to get both outputs of the legend?If there is not any output from the legend, the symbol of the polyshape is visible:
p=plot(polyshape([0 0 1 1],[1 0 0 1]));
legend(p);
Instead, if I try to get both outputs of the legend with a polyshape, the symbol of the polyshape disappears:
p=plot(polyshape([0 0 1 1],[1 0 0 1]));
[h,objh]=legend(p);
How can I still see/visualise the symbol of the polyshape, when I need to get both outputs of the legend? If there is not any output from the legend, the symbol of the polyshape is visible:
p=plot(polyshape([0 0 1 1],[1 0 0 1]));
legend(p);
Instead, if I try to get both outputs of the legend with a polyshape, the symbol of the polyshape disappears:
p=plot(polyshape([0 0 1 1],[1 0 0 1]));
[h,objh]=legend(p);
How can I still see/visualise the symbol of the polyshape, when I need to get both outputs of the legend? polyshape, legend MATLAB Answers — New Questions
Can someone help me to configure the gate of IGBT/Diode ? I failed to connect the PWM generator
I need help to connect PWM generator to the Gate of the IGBT/Diode RectifierI need help to connect PWM generator to the Gate of the IGBT/Diode Rectifier I need help to connect PWM generator to the Gate of the IGBT/Diode Rectifier igbt MATLAB Answers — New Questions
ECG P QRS T wave detecting matlab code
I really need a matlab code for detecting the P,Q,R,S,T points on a ecg waveform.
I searched a lot and found some links, but I couldnt properly run it. I am not much into matlab.Hope you give a step by step explanation. Thanks you :DI really need a matlab code for detecting the P,Q,R,S,T points on a ecg waveform.
I searched a lot and found some links, but I couldnt properly run it. I am not much into matlab.Hope you give a step by step explanation. Thanks you 😀 I really need a matlab code for detecting the P,Q,R,S,T points on a ecg waveform.
I searched a lot and found some links, but I couldnt properly run it. I am not much into matlab.Hope you give a step by step explanation. Thanks you 😀 ecg, pwave, qwave, rwave, swave, qrswave, twave, qrs detection MATLAB Answers — New Questions
Video source object does not acquire data – USB Vision
Hello, i have a problem where i am unable to get the video source object to acquire video frames.
Using a USB Vision 3.0 Camera from HIKROBOT
I have tried a few varieties, with a Manual Trigger and automatic trigger, but whenever i try to get the data from the camera it times out.
The reason for the timeout i assume to be that the src.Parent status is:
Acquisition Parameters: ‘Stream0’ is the current selected source.
10 frames per trigger using the selected source.
‘Mono8’ video data to be logged upon START.
Grabbing first of every 1 frame(s).
Log data to ‘memory’ on trigger.
Trigger Parameters: 1 ‘immediate’ trigger(s) on START.
Status: Logging data.
0 frames acquired since starting.
0 frames available for GETDATA.
Is there something obvious i am missing?
vid = videoinput("gentl");
src = getselectedsource(vid);
commands(src);
start(vid);
data = getsnapshot(vid);Hello, i have a problem where i am unable to get the video source object to acquire video frames.
Using a USB Vision 3.0 Camera from HIKROBOT
I have tried a few varieties, with a Manual Trigger and automatic trigger, but whenever i try to get the data from the camera it times out.
The reason for the timeout i assume to be that the src.Parent status is:
Acquisition Parameters: ‘Stream0’ is the current selected source.
10 frames per trigger using the selected source.
‘Mono8’ video data to be logged upon START.
Grabbing first of every 1 frame(s).
Log data to ‘memory’ on trigger.
Trigger Parameters: 1 ‘immediate’ trigger(s) on START.
Status: Logging data.
0 frames acquired since starting.
0 frames available for GETDATA.
Is there something obvious i am missing?
vid = videoinput("gentl");
src = getselectedsource(vid);
commands(src);
start(vid);
data = getsnapshot(vid); Hello, i have a problem where i am unable to get the video source object to acquire video frames.
Using a USB Vision 3.0 Camera from HIKROBOT
I have tried a few varieties, with a Manual Trigger and automatic trigger, but whenever i try to get the data from the camera it times out.
The reason for the timeout i assume to be that the src.Parent status is:
Acquisition Parameters: ‘Stream0’ is the current selected source.
10 frames per trigger using the selected source.
‘Mono8’ video data to be logged upon START.
Grabbing first of every 1 frame(s).
Log data to ‘memory’ on trigger.
Trigger Parameters: 1 ‘immediate’ trigger(s) on START.
Status: Logging data.
0 frames acquired since starting.
0 frames available for GETDATA.
Is there something obvious i am missing?
vid = videoinput("gentl");
src = getselectedsource(vid);
commands(src);
start(vid);
data = getsnapshot(vid); image acquisition, usb, vision MATLAB Answers — New Questions