Tag Archives: matlab
Is it possible to load the input data from base workspace to the inports in the simulink model without enabling the external input in configuration parameters?
When working with Simulink models, it is often necessary to input data from external sources for simulation purposes. Typically, this can be done by specifying external inputs in the model’s configuration parameters. However, there might be scenarios where you prefer or need to load the input data directly from the MATLAB base workspace to the inport blocks of a Simulink model, without enabling the configuration parameter settings for external inputs.
The input data is already available in the MATLAB workspace so can we directly assign it to the inport block ?When working with Simulink models, it is often necessary to input data from external sources for simulation purposes. Typically, this can be done by specifying external inputs in the model’s configuration parameters. However, there might be scenarios where you prefer or need to load the input data directly from the MATLAB base workspace to the inport blocks of a Simulink model, without enabling the configuration parameter settings for external inputs.
The input data is already available in the MATLAB workspace so can we directly assign it to the inport block ? When working with Simulink models, it is often necessary to input data from external sources for simulation purposes. Typically, this can be done by specifying external inputs in the model’s configuration parameters. However, there might be scenarios where you prefer or need to load the input data directly from the MATLAB base workspace to the inport blocks of a Simulink model, without enabling the configuration parameter settings for external inputs.
The input data is already available in the MATLAB workspace so can we directly assign it to the inport block ? simulink, matlab MATLAB Answers — New Questions
How can I remove objects that fit within a certain circular radius?
I am currently trying to create a mask of an image to only capture certain vasculature in an image. I have created a mask that uses a specific sensitivity value to only get the darker areas (which would represent the blood vessels), but I am also picking up smaller circle-like areas that do not represent that vasculature. Is there a way for me to detect if certain white areas are within a circular radius and then delete them? Here is my code so far:
binarizedImage1 = imbinarize(repairedImage1, ‘adaptive’, ‘Sensitivity’, 0.8);
binarizedImage1 = ~binarizedImage1;
imshow(binarizedImage1)
BWao = bwareaopen(binarizedImage1, 500);
nhood = ones(3);
closeBWao = imclose(BWao,nhood);
mask = imfill(closeBWao,’holes’);I am currently trying to create a mask of an image to only capture certain vasculature in an image. I have created a mask that uses a specific sensitivity value to only get the darker areas (which would represent the blood vessels), but I am also picking up smaller circle-like areas that do not represent that vasculature. Is there a way for me to detect if certain white areas are within a circular radius and then delete them? Here is my code so far:
binarizedImage1 = imbinarize(repairedImage1, ‘adaptive’, ‘Sensitivity’, 0.8);
binarizedImage1 = ~binarizedImage1;
imshow(binarizedImage1)
BWao = bwareaopen(binarizedImage1, 500);
nhood = ones(3);
closeBWao = imclose(BWao,nhood);
mask = imfill(closeBWao,’holes’); I am currently trying to create a mask of an image to only capture certain vasculature in an image. I have created a mask that uses a specific sensitivity value to only get the darker areas (which would represent the blood vessels), but I am also picking up smaller circle-like areas that do not represent that vasculature. Is there a way for me to detect if certain white areas are within a circular radius and then delete them? Here is my code so far:
binarizedImage1 = imbinarize(repairedImage1, ‘adaptive’, ‘Sensitivity’, 0.8);
binarizedImage1 = ~binarizedImage1;
imshow(binarizedImage1)
BWao = bwareaopen(binarizedImage1, 500);
nhood = ones(3);
closeBWao = imclose(BWao,nhood);
mask = imfill(closeBWao,’holes’); matlab, image processing, filter, image analysis, image segmentation MATLAB Answers — New Questions
how to access ethernet port using matlab
i need to establish a point to point communication using ethernet,
we are just sending the frames without using TCP/ip protocol. Now, how to access the frames coming from ethernet using MATLAB??.can anybody say the list of matlab commands used.?i need to establish a point to point communication using ethernet,
we are just sending the frames without using TCP/ip protocol. Now, how to access the frames coming from ethernet using MATLAB??.can anybody say the list of matlab commands used.? i need to establish a point to point communication using ethernet,
we are just sending the frames without using TCP/ip protocol. Now, how to access the frames coming from ethernet using MATLAB??.can anybody say the list of matlab commands used.? ethernet port access MATLAB Answers — New Questions
Reactive power calculating inductive load as -Q [-VARs]
Since my simulation has an inductive load, I don’t understand why the power block is calculating a negative reactive power. In an inductive load, current lags voltage and thus the reactive load is seen as a positive vars.Since my simulation has an inductive load, I don’t understand why the power block is calculating a negative reactive power. In an inductive load, current lags voltage and thus the reactive load is seen as a positive vars. Since my simulation has an inductive load, I don’t understand why the power block is calculating a negative reactive power. In an inductive load, current lags voltage and thus the reactive load is seen as a positive vars. reactive power calculation MATLAB Answers — New Questions
want to plot a function
Hi
I want to plot a function
and
the ref plot is
and now I code is
clc
clear
close all;
f=0:10:60;
tk=0.1;
tK=4;
theta0=-0.4;
theta1=0.3;
theta2=13.8/0.2;
for i=(0 0.1 40)
H=(theta0*(tK-tk))+(theta1*(exp(-theta2*tk*i)));
end
plot(f,H)
please help me how do i change my code to fix it?
ThankSHi
I want to plot a function
and
the ref plot is
and now I code is
clc
clear
close all;
f=0:10:60;
tk=0.1;
tK=4;
theta0=-0.4;
theta1=0.3;
theta2=13.8/0.2;
for i=(0 0.1 40)
H=(theta0*(tK-tk))+(theta1*(exp(-theta2*tk*i)));
end
plot(f,H)
please help me how do i change my code to fix it?
ThankS Hi
I want to plot a function
and
the ref plot is
and now I code is
clc
clear
close all;
f=0:10:60;
tk=0.1;
tK=4;
theta0=-0.4;
theta1=0.3;
theta2=13.8/0.2;
for i=(0 0.1 40)
H=(theta0*(tK-tk))+(theta1*(exp(-theta2*tk*i)));
end
plot(f,H)
please help me how do i change my code to fix it?
ThankS plot MATLAB Answers — New Questions
Previously visible GPIB interface now invisible in visadevlist
I am using a Keithley 2401 sourcemeter connected to my PC via a GPIB-USB interface. A week ago, I was able to see the device listed after prompting visadevlist and the device would be listed as GPIB0::10::INSTR under ResourceName. Now, visadevlist does not list any GPIB devices, while NI MAX is able to connect to the tool and I am able to read, write and query the tool using the interactive controls. I have upgraded my MATLAB version to 2024a from 2023a, uninstalled and reinstalled the Instrument Control Toolbox, 488.2 and GPIB drivers, NI MAX and NI VISA several times to no avail. I have used instrreset and delete(visadevfind) as well, no difference.I am using a Keithley 2401 sourcemeter connected to my PC via a GPIB-USB interface. A week ago, I was able to see the device listed after prompting visadevlist and the device would be listed as GPIB0::10::INSTR under ResourceName. Now, visadevlist does not list any GPIB devices, while NI MAX is able to connect to the tool and I am able to read, write and query the tool using the interactive controls. I have upgraded my MATLAB version to 2024a from 2023a, uninstalled and reinstalled the Instrument Control Toolbox, 488.2 and GPIB drivers, NI MAX and NI VISA several times to no avail. I have used instrreset and delete(visadevfind) as well, no difference. I am using a Keithley 2401 sourcemeter connected to my PC via a GPIB-USB interface. A week ago, I was able to see the device listed after prompting visadevlist and the device would be listed as GPIB0::10::INSTR under ResourceName. Now, visadevlist does not list any GPIB devices, while NI MAX is able to connect to the tool and I am able to read, write and query the tool using the interactive controls. I have upgraded my MATLAB version to 2024a from 2023a, uninstalled and reinstalled the Instrument Control Toolbox, 488.2 and GPIB drivers, NI MAX and NI VISA several times to no avail. I have used instrreset and delete(visadevfind) as well, no difference. keithley, visa, ni, visadevlist, instrument control, gpib MATLAB Answers — New Questions
About running Matlab program in a Laptop
Can I run long Matlab program, that takes 4-5 days, in a Laptop with lid off (If I set condition never sleep)?Can I run long Matlab program, that takes 4-5 days, in a Laptop with lid off (If I set condition never sleep)? Can I run long Matlab program, that takes 4-5 days, in a Laptop with lid off (If I set condition never sleep)? about running matlab program in a lapto MATLAB Answers — New Questions
set a maximum training time for training a PPO agent
In training process of a PPO RL agent, how can I make the code check the elapsed time and stop training if it exceeds the desired threshold. Suppose you want to stop training after a maximum of 30 minutes (1800 seconds).In training process of a PPO RL agent, how can I make the code check the elapsed time and stop training if it exceeds the desired threshold. Suppose you want to stop training after a maximum of 30 minutes (1800 seconds). In training process of a PPO RL agent, how can I make the code check the elapsed time and stop training if it exceeds the desired threshold. Suppose you want to stop training after a maximum of 30 minutes (1800 seconds). reinforcement learning MATLAB Answers — New Questions
matlab work slowly when plot
Hello, I’m Having problem Which is when i run my code and there is plot in the code, matlab work very slowly and take more time.
also when i wan’t to zoom in or zoom out for the figure it take more than 5 minutes also it hang and the control is very slowly any help ?
the code work fine and no problem with it.Hello, I’m Having problem Which is when i run my code and there is plot in the code, matlab work very slowly and take more time.
also when i wan’t to zoom in or zoom out for the figure it take more than 5 minutes also it hang and the control is very slowly any help ?
the code work fine and no problem with it. Hello, I’m Having problem Which is when i run my code and there is plot in the code, matlab work very slowly and take more time.
also when i wan’t to zoom in or zoom out for the figure it take more than 5 minutes also it hang and the control is very slowly any help ?
the code work fine and no problem with it. matlab MATLAB Answers — New Questions
How to Filter Rows of Cell Array By Date Range
Simplied my problem so it’s easier to solve. I have a 4×3 array "a" and want to remove rows not within a specified date range. I would like to do this without a loop that would slow down my code. Any suggestions matlab wizards out there?
%Date Range
MinDate = datetime(’14-Jul-2024′);
MaxDate = datetime(’17-July-2024′);
%Cell Array
a = cell(4,3);
random = [1 1
2 1
3 3
4 5];
dates = datetime({’10-Jul-2024′
’15-Jul-2024′
’20-Jul-2024′
’16-Jul-2024′});
a(:,3) = num2cell(dates);
a(:,1:2) = num2cell(random);
%How do I filter a by deleting rows not within Date Range? i.e. delete rows 1 & 3 based on the value of aSimplied my problem so it’s easier to solve. I have a 4×3 array "a" and want to remove rows not within a specified date range. I would like to do this without a loop that would slow down my code. Any suggestions matlab wizards out there?
%Date Range
MinDate = datetime(’14-Jul-2024′);
MaxDate = datetime(’17-July-2024′);
%Cell Array
a = cell(4,3);
random = [1 1
2 1
3 3
4 5];
dates = datetime({’10-Jul-2024′
’15-Jul-2024′
’20-Jul-2024′
’16-Jul-2024′});
a(:,3) = num2cell(dates);
a(:,1:2) = num2cell(random);
%How do I filter a by deleting rows not within Date Range? i.e. delete rows 1 & 3 based on the value of a Simplied my problem so it’s easier to solve. I have a 4×3 array "a" and want to remove rows not within a specified date range. I would like to do this without a loop that would slow down my code. Any suggestions matlab wizards out there?
%Date Range
MinDate = datetime(’14-Jul-2024′);
MaxDate = datetime(’17-July-2024′);
%Cell Array
a = cell(4,3);
random = [1 1
2 1
3 3
4 5];
dates = datetime({’10-Jul-2024′
’15-Jul-2024′
’20-Jul-2024′
’16-Jul-2024′});
a(:,3) = num2cell(dates);
a(:,1:2) = num2cell(random);
%How do I filter a by deleting rows not within Date Range? i.e. delete rows 1 & 3 based on the value of a cell array, array, arrays, matrix, datetime, data, cell, cell arrays, struct, importing excel data, sort, filter, matlab, mathematics, matrix array, matrix manipulation, index, indexing, find, solve, function, functions, matlab function, embedded matlab function, speed, performance MATLAB Answers — New Questions
How do I assign membership functions to the input and output of this ANFIS code
I want to add membership function to this ANFIS code to be able to train it. the membership function type is Gaussian and the number of mfs is numMembershipFunctions = [4 3 2 3 3 4 2] .Attached is the dataset file. The code is:
data = loadpublicHealthHeartDataset;
X = data(:,1:6);
Y = data(:,7);
trnData=[X,Y];
trnX = X(1:2:end,:); % Training input data set
trnY = Y(1:2:end,:); % Training output data set
vldX = X(2:2:end,:); % Validation input data set
vldY = Y(2:2:end,:); % Validation output data set
% Tune the data using Anfis
genAnfis = genfis(trnX,trnY, genfisOptions(‘GridPartition’));
opt = anfisOptions;
opt.InitialFIS = genAnfis;
opt.ValidationData = [vldX,vldY];
opt.EpochNumber = 30;
anfis1 = anfis(trnData,opt);
% Function to upload the dataset
function data= loadpublicHealthHeartDataset
% Get data from the original data file.
tableData = readtable("heartss.CSV");
% Convert the table to a numerical array
data = table2array(tableData(:, 1:7));
endI want to add membership function to this ANFIS code to be able to train it. the membership function type is Gaussian and the number of mfs is numMembershipFunctions = [4 3 2 3 3 4 2] .Attached is the dataset file. The code is:
data = loadpublicHealthHeartDataset;
X = data(:,1:6);
Y = data(:,7);
trnData=[X,Y];
trnX = X(1:2:end,:); % Training input data set
trnY = Y(1:2:end,:); % Training output data set
vldX = X(2:2:end,:); % Validation input data set
vldY = Y(2:2:end,:); % Validation output data set
% Tune the data using Anfis
genAnfis = genfis(trnX,trnY, genfisOptions(‘GridPartition’));
opt = anfisOptions;
opt.InitialFIS = genAnfis;
opt.ValidationData = [vldX,vldY];
opt.EpochNumber = 30;
anfis1 = anfis(trnData,opt);
% Function to upload the dataset
function data= loadpublicHealthHeartDataset
% Get data from the original data file.
tableData = readtable("heartss.CSV");
% Convert the table to a numerical array
data = table2array(tableData(:, 1:7));
end I want to add membership function to this ANFIS code to be able to train it. the membership function type is Gaussian and the number of mfs is numMembershipFunctions = [4 3 2 3 3 4 2] .Attached is the dataset file. The code is:
data = loadpublicHealthHeartDataset;
X = data(:,1:6);
Y = data(:,7);
trnData=[X,Y];
trnX = X(1:2:end,:); % Training input data set
trnY = Y(1:2:end,:); % Training output data set
vldX = X(2:2:end,:); % Validation input data set
vldY = Y(2:2:end,:); % Validation output data set
% Tune the data using Anfis
genAnfis = genfis(trnX,trnY, genfisOptions(‘GridPartition’));
opt = anfisOptions;
opt.InitialFIS = genAnfis;
opt.ValidationData = [vldX,vldY];
opt.EpochNumber = 30;
anfis1 = anfis(trnData,opt);
% Function to upload the dataset
function data= loadpublicHealthHeartDataset
% Get data from the original data file.
tableData = readtable("heartss.CSV");
% Convert the table to a numerical array
data = table2array(tableData(:, 1:7));
end anfis, membership function MATLAB Answers — New Questions
Generate look angles between aircraft and satellite
I need to calculate pointing angles from an antenna mounted on top of an airplane to a satellite. The plane will be flying in a large circle and the mounted antenna’s elevation must stay above 20 degrees. The satellite is GEO and can be considered stationary. These pointing angles must take into consideration aircraft roll, pitch, and yaw, antenna orientation with respect to the airframe.
Does the Aerospace or some other toolbox contain codes for this problem?I need to calculate pointing angles from an antenna mounted on top of an airplane to a satellite. The plane will be flying in a large circle and the mounted antenna’s elevation must stay above 20 degrees. The satellite is GEO and can be considered stationary. These pointing angles must take into consideration aircraft roll, pitch, and yaw, antenna orientation with respect to the airframe.
Does the Aerospace or some other toolbox contain codes for this problem? I need to calculate pointing angles from an antenna mounted on top of an airplane to a satellite. The plane will be flying in a large circle and the mounted antenna’s elevation must stay above 20 degrees. The satellite is GEO and can be considered stationary. These pointing angles must take into consideration aircraft roll, pitch, and yaw, antenna orientation with respect to the airframe.
Does the Aerospace or some other toolbox contain codes for this problem? look angles, matlab, antenna, rf, azimuth, elevation MATLAB Answers — New Questions
How Do I Convert and Image To A Line/Array
I am trying to create a software to covert MRI images into a 3D model and i am trying to create a line body or basic main body umage that i can use to stack and then connect in a mesh whcih i will convert into a 3D model. I have sharpened the images and reduced noise, i have it in grayscale but how do i get it down into a basic image or linbe so i can plot it. has anyone done somthing similar? Do you have a solution?I am trying to create a software to covert MRI images into a 3D model and i am trying to create a line body or basic main body umage that i can use to stack and then connect in a mesh whcih i will convert into a 3D model. I have sharpened the images and reduced noise, i have it in grayscale but how do i get it down into a basic image or linbe so i can plot it. has anyone done somthing similar? Do you have a solution? I am trying to create a software to covert MRI images into a 3D model and i am trying to create a line body or basic main body umage that i can use to stack and then connect in a mesh whcih i will convert into a 3D model. I have sharpened the images and reduced noise, i have it in grayscale but how do i get it down into a basic image or linbe so i can plot it. has anyone done somthing similar? Do you have a solution? medicine, matlab MATLAB Answers — New Questions
Storing data to flash on F280039C from a Simulink model
I am currently trying to store parameters of a recursive regression model created in Simulink to some sort of nonvolatile memory on the TI C2000 gen3 / F280039C board, such that the calculations can continue after turning the device off and on again. I have found an EEPROM emulation project from mathworks (https://ch.mathworks.com/matlabcentral/fileexchange/92788-simulink-reference-application-examples-for-ti-c2000), which is however made for a different board and older generation of the TI C2000.
Is there any possibility to port this project to my newer board, or other ways to store my data in a nonvolatile manner from Simulink? What do I need to take into consideration when doing this?I am currently trying to store parameters of a recursive regression model created in Simulink to some sort of nonvolatile memory on the TI C2000 gen3 / F280039C board, such that the calculations can continue after turning the device off and on again. I have found an EEPROM emulation project from mathworks (https://ch.mathworks.com/matlabcentral/fileexchange/92788-simulink-reference-application-examples-for-ti-c2000), which is however made for a different board and older generation of the TI C2000.
Is there any possibility to port this project to my newer board, or other ways to store my data in a nonvolatile manner from Simulink? What do I need to take into consideration when doing this? I am currently trying to store parameters of a recursive regression model created in Simulink to some sort of nonvolatile memory on the TI C2000 gen3 / F280039C board, such that the calculations can continue after turning the device off and on again. I have found an EEPROM emulation project from mathworks (https://ch.mathworks.com/matlabcentral/fileexchange/92788-simulink-reference-application-examples-for-ti-c2000), which is however made for a different board and older generation of the TI C2000.
Is there any possibility to port this project to my newer board, or other ways to store my data in a nonvolatile manner from Simulink? What do I need to take into consideration when doing this? f280039c eeprom emulation, ti-c2000 eeprom emulation, f280039c nonvolatile memory, ti-c2000 nonvolatile memory MATLAB Answers — New Questions
How to convert something from Latex to matlab, is there a specific way where i can convert it with ease from latex to matlab, some function? please help
is there a specific way where i can convert it with ease from latex to matlab
an example of an equation i want to know how can i write it in matlab form from latex
example 1:
begin{equation} h_{k}=frac {A(m+1)}{2 pi d_{k}^{2}}cos ^{m}(phi _{k})T(psi _{k})g(psi _{k})cos (psi _{k}), end{equation}
example 2:
begin{align} tilde {R}_{k rightarrow j}!=! begin{cases} !! frac {B}{2} log _{2}left ({1 + frac {left ({ h_{k} a_{j} }right )^{2}} {sum _{i=j+1}^{K}left ({ h_{k} a_{i} }right )^{2} + varepsilon sum _{i=1}^{j-1}left ({ h_{k} a_{i} }right )^{2}+ 1/rho } }right ) geq T_{j},\ qquad j leq k,j neq K;\ !! frac {B}{2}log _{2} left ({! 1!+!frac {left ({ h_{K} a_{j} }right )^{2}} {varepsilon sum _{i=1}^{j-1}left ({ h_{K} a_{i} }right )^{2}+1/rho }}right ) !geq ! T_{j} , quad j=k=K;end{cases}!!!!!!!notag \ {}end{align}is there a specific way where i can convert it with ease from latex to matlab
an example of an equation i want to know how can i write it in matlab form from latex
example 1:
begin{equation} h_{k}=frac {A(m+1)}{2 pi d_{k}^{2}}cos ^{m}(phi _{k})T(psi _{k})g(psi _{k})cos (psi _{k}), end{equation}
example 2:
begin{align} tilde {R}_{k rightarrow j}!=! begin{cases} !! frac {B}{2} log _{2}left ({1 + frac {left ({ h_{k} a_{j} }right )^{2}} {sum _{i=j+1}^{K}left ({ h_{k} a_{i} }right )^{2} + varepsilon sum _{i=1}^{j-1}left ({ h_{k} a_{i} }right )^{2}+ 1/rho } }right ) geq T_{j},\ qquad j leq k,j neq K;\ !! frac {B}{2}log _{2} left ({! 1!+!frac {left ({ h_{K} a_{j} }right )^{2}} {varepsilon sum _{i=1}^{j-1}left ({ h_{K} a_{i} }right )^{2}+1/rho }}right ) !geq ! T_{j} , quad j=k=K;end{cases}!!!!!!!notag \ {}end{align} is there a specific way where i can convert it with ease from latex to matlab
an example of an equation i want to know how can i write it in matlab form from latex
example 1:
begin{equation} h_{k}=frac {A(m+1)}{2 pi d_{k}^{2}}cos ^{m}(phi _{k})T(psi _{k})g(psi _{k})cos (psi _{k}), end{equation}
example 2:
begin{align} tilde {R}_{k rightarrow j}!=! begin{cases} !! frac {B}{2} log _{2}left ({1 + frac {left ({ h_{k} a_{j} }right )^{2}} {sum _{i=j+1}^{K}left ({ h_{k} a_{i} }right )^{2} + varepsilon sum _{i=1}^{j-1}left ({ h_{k} a_{i} }right )^{2}+ 1/rho } }right ) geq T_{j},\ qquad j leq k,j neq K;\ !! frac {B}{2}log _{2} left ({! 1!+!frac {left ({ h_{K} a_{j} }right )^{2}} {varepsilon sum _{i=1}^{j-1}left ({ h_{K} a_{i} }right )^{2}+1/rho }}right ) !geq ! T_{j} , quad j=k=K;end{cases}!!!!!!!notag \ {}end{align} how to, latex, tex, special characters MATLAB Answers — New Questions
How should I assess the training of my agent using PPO and Q-learning?
Urgent !!!!
Hello everybody
I am working on my project to implement a reinforcement learning agent to evaluate the security level of a waf with sql injection.
I started by training two PPO and Q-learning algorithms. I would like you to help me analyze the convergent curve of my models and also if there are parameters to adjust in order to find the right learning rate value.
you will find my code attached and on the image the rewards by episodesUrgent !!!!
Hello everybody
I am working on my project to implement a reinforcement learning agent to evaluate the security level of a waf with sql injection.
I started by training two PPO and Q-learning algorithms. I would like you to help me analyze the convergent curve of my models and also if there are parameters to adjust in order to find the right learning rate value.
you will find my code attached and on the image the rewards by episodes Urgent !!!!
Hello everybody
I am working on my project to implement a reinforcement learning agent to evaluate the security level of a waf with sql injection.
I started by training two PPO and Q-learning algorithms. I would like you to help me analyze the convergent curve of my models and also if there are parameters to adjust in order to find the right learning rate value.
you will find my code attached and on the image the rewards by episodes transferred MATLAB Answers — New Questions
Converting Equation of Two Variables Into Matrix Elements – ERROR: Operator ‘*’ is not supported for operands of type ‘function_handle’.
Hello everyone,
I am trying to output a square matrix that is N x M in size, where N = M. In my case, N = 3. So this is a "3×3" matrix
I have a variable that’s called "Kernel". This variable is calculated as an equation in terms of "z" and "z_prime".
My values in z_prime will vary from L / 2N to (2N-1)*(L/2N) , in steps of "L/N".
My "z" variable will be used as an "integration variable" as seen below.
I am trying to calculate an output called the "Z Matrix" which will integrate the "Kernal" variable across specific ranges.
I attached a .pdf file to clarify my end goal.
See the .pdf file attached:
Z_Matrix_Output.pdf
My Integration Limits for "z" will be going from:
z_start = 0 : L/N : (N-1) * (L/N)
z_end = L/N : L/N : L
As of right now, I’m getting the error:
Operator ‘*’ is not supported for operands of type ‘function_handle’.
This is after I tried using "function handles" in my code.
In my attempt, I have tried to use for loops and created function handles to make it easier to generate this matrix.However, I didn’t end up with a "N X M" matrix, I just ended up with a "1 X N" matrix.
I know that there is a way to use "nested" for loops to generate a square matrix of an "N X M" size. However, I wasn’t quite sure on how to implement that in MATLAB for my case.
I have tried to look through different questions/answers on the Mathworks Forum regarding converting equations of two variables into "matrix elements". However, I wasn’t able to find anything that was relevant to my case.
I attached my MATLAB Code for reference.
See MATLAB .m file attached:
Z_Calculation.mHello everyone,
I am trying to output a square matrix that is N x M in size, where N = M. In my case, N = 3. So this is a "3×3" matrix
I have a variable that’s called "Kernel". This variable is calculated as an equation in terms of "z" and "z_prime".
My values in z_prime will vary from L / 2N to (2N-1)*(L/2N) , in steps of "L/N".
My "z" variable will be used as an "integration variable" as seen below.
I am trying to calculate an output called the "Z Matrix" which will integrate the "Kernal" variable across specific ranges.
I attached a .pdf file to clarify my end goal.
See the .pdf file attached:
Z_Matrix_Output.pdf
My Integration Limits for "z" will be going from:
z_start = 0 : L/N : (N-1) * (L/N)
z_end = L/N : L/N : L
As of right now, I’m getting the error:
Operator ‘*’ is not supported for operands of type ‘function_handle’.
This is after I tried using "function handles" in my code.
In my attempt, I have tried to use for loops and created function handles to make it easier to generate this matrix.However, I didn’t end up with a "N X M" matrix, I just ended up with a "1 X N" matrix.
I know that there is a way to use "nested" for loops to generate a square matrix of an "N X M" size. However, I wasn’t quite sure on how to implement that in MATLAB for my case.
I have tried to look through different questions/answers on the Mathworks Forum regarding converting equations of two variables into "matrix elements". However, I wasn’t able to find anything that was relevant to my case.
I attached my MATLAB Code for reference.
See MATLAB .m file attached:
Z_Calculation.m Hello everyone,
I am trying to output a square matrix that is N x M in size, where N = M. In my case, N = 3. So this is a "3×3" matrix
I have a variable that’s called "Kernel". This variable is calculated as an equation in terms of "z" and "z_prime".
My values in z_prime will vary from L / 2N to (2N-1)*(L/2N) , in steps of "L/N".
My "z" variable will be used as an "integration variable" as seen below.
I am trying to calculate an output called the "Z Matrix" which will integrate the "Kernal" variable across specific ranges.
I attached a .pdf file to clarify my end goal.
See the .pdf file attached:
Z_Matrix_Output.pdf
My Integration Limits for "z" will be going from:
z_start = 0 : L/N : (N-1) * (L/N)
z_end = L/N : L/N : L
As of right now, I’m getting the error:
Operator ‘*’ is not supported for operands of type ‘function_handle’.
This is after I tried using "function handles" in my code.
In my attempt, I have tried to use for loops and created function handles to make it easier to generate this matrix.However, I didn’t end up with a "N X M" matrix, I just ended up with a "1 X N" matrix.
I know that there is a way to use "nested" for loops to generate a square matrix of an "N X M" size. However, I wasn’t quite sure on how to implement that in MATLAB for my case.
I have tried to look through different questions/answers on the Mathworks Forum regarding converting equations of two variables into "matrix elements". However, I wasn’t able to find anything that was relevant to my case.
I attached my MATLAB Code for reference.
See MATLAB .m file attached:
Z_Calculation.m matrix array, matrix, matrix manipulation, integration, numerical integration MATLAB Answers — New Questions
Any ideas for making this exponential decay function match the actual data better?
Hi all,
I have been trying to fit some weight data that was collected over time to an exponential decay function. I have come up with the following:
f(t) = An + (A0 – An) * exp (- t / tau)
Where: An = final data point measured, A0 = initial data point measured, and tau = a time constant that I am seeking to fit/solve for.
I am using the following code to set up the decay and solve for tau. Data is the collected weight data and t is the times at which the data was collected:
funlist={@(tau, t) An + (A0 – An) .* exp(-t / tau),1}; % define function
[tau]=fminspleas(funlist,1,time,data); % tau estimate
A0 = data(1);
An = data(end);
fn_data=@(t) funlist{1}(tau,t);
When I go to plot the data points to compare it with the fit, I notice the decay function does not do well at later time points where there is a greater plateau (see attached). I am wondering if anyone has any code or functions suggestions to help improve the fit of the curve? Any suggestions are welcome. Thank you very much!Hi all,
I have been trying to fit some weight data that was collected over time to an exponential decay function. I have come up with the following:
f(t) = An + (A0 – An) * exp (- t / tau)
Where: An = final data point measured, A0 = initial data point measured, and tau = a time constant that I am seeking to fit/solve for.
I am using the following code to set up the decay and solve for tau. Data is the collected weight data and t is the times at which the data was collected:
funlist={@(tau, t) An + (A0 – An) .* exp(-t / tau),1}; % define function
[tau]=fminspleas(funlist,1,time,data); % tau estimate
A0 = data(1);
An = data(end);
fn_data=@(t) funlist{1}(tau,t);
When I go to plot the data points to compare it with the fit, I notice the decay function does not do well at later time points where there is a greater plateau (see attached). I am wondering if anyone has any code or functions suggestions to help improve the fit of the curve? Any suggestions are welcome. Thank you very much! Hi all,
I have been trying to fit some weight data that was collected over time to an exponential decay function. I have come up with the following:
f(t) = An + (A0 – An) * exp (- t / tau)
Where: An = final data point measured, A0 = initial data point measured, and tau = a time constant that I am seeking to fit/solve for.
I am using the following code to set up the decay and solve for tau. Data is the collected weight data and t is the times at which the data was collected:
funlist={@(tau, t) An + (A0 – An) .* exp(-t / tau),1}; % define function
[tau]=fminspleas(funlist,1,time,data); % tau estimate
A0 = data(1);
An = data(end);
fn_data=@(t) funlist{1}(tau,t);
When I go to plot the data points to compare it with the fit, I notice the decay function does not do well at later time points where there is a greater plateau (see attached). I am wondering if anyone has any code or functions suggestions to help improve the fit of the curve? Any suggestions are welcome. Thank you very much! exponential decay, custom cuve fitting MATLAB Answers — New Questions
Issue with Contact analysis in Simscape – solid body contact
Hi,
I am trying to simulate a gear pair contact analysis in Simscape where I import the bodies from stl file. Upon simulation, the gear tooth meshings are not happening correctly and I have severe interference. I tried solving the issue with different solvers, but still the meshing is not appropriate. Could you please suggest how I can solve this issue?
Thanks,
AnandHi,
I am trying to simulate a gear pair contact analysis in Simscape where I import the bodies from stl file. Upon simulation, the gear tooth meshings are not happening correctly and I have severe interference. I tried solving the issue with different solvers, but still the meshing is not appropriate. Could you please suggest how I can solve this issue?
Thanks,
Anand Hi,
I am trying to simulate a gear pair contact analysis in Simscape where I import the bodies from stl file. Upon simulation, the gear tooth meshings are not happening correctly and I have severe interference. I tried solving the issue with different solvers, but still the meshing is not appropriate. Could you please suggest how I can solve this issue?
Thanks,
Anand simscape, contact, gears, contact analysis MATLAB Answers — New Questions
How to fill missing time points from a txt file
I have txt files that I am trying to read in and towards the end of the file it starts skipping time values and data points. I am trying to compare this txt file to another excel data set. I would like to create the missing time variables on the txt file and just fill them with NaN variables that way I can better match up the time. Should I use the fillmissing function? Any suggestion would be appreciated.
The excel file is also time shifted by about 3 seconds late so that is another problem I will have to face.I have txt files that I am trying to read in and towards the end of the file it starts skipping time values and data points. I am trying to compare this txt file to another excel data set. I would like to create the missing time variables on the txt file and just fill them with NaN variables that way I can better match up the time. Should I use the fillmissing function? Any suggestion would be appreciated.
The excel file is also time shifted by about 3 seconds late so that is another problem I will have to face. I have txt files that I am trying to read in and towards the end of the file it starts skipping time values and data points. I am trying to compare this txt file to another excel data set. I would like to create the missing time variables on the txt file and just fill them with NaN variables that way I can better match up the time. Should I use the fillmissing function? Any suggestion would be appreciated.
The excel file is also time shifted by about 3 seconds late so that is another problem I will have to face. fillmissing, readtable, retime, missing data MATLAB Answers — New Questions