Tag Archives: matlab
Why do I get such different values for R, G and B for very similar photos?
I previously asked this question here. .Since then I have been finding answers little by little to the doubts that have arisen.
In short, I am applying a mask to a series of photos of a sample which is changing color over time. From each of these photos I am measuring the mean R, G and B values within the mask and then transforming them to L, a and b, and finally obtaining the Delta E values between each photo and the first one.
At first, with small samples, everything worked well, and I was able to obtain graphs like the following:
these from samples such as the following:
However, then, using larger samples, I am getting values like the following:
As I said, the only thing I did was to increase the sample size (plus change the time between each photo from about three per second to one per second, and increase the total number of photos by almost 2000).
The origin of the problem seems to be in the measurement of the values of R, G and B, because from these I did the rest of the calculations. For the large sample, where the error occurs, the values of R, G and B go up and down drastically in a strange way from photo 100 to 1800, more or less.
I checked photo 98, 99, 100 and 101 and at first sight they are identical, so the error is not born (apparently) from the analyzed photos.
These are the photos when all start to fail.
I use two codes, the first one (made by Data Analyst, shared by himself in one of the links I put in my first question) to make the mask and verify that it has a correct shape and size. And the second one to apply this mask to each of the photos of the sample and obtain from this process the values of R, G, B, L, a, b and Delta E. Finally, I also use another one to make the graphs. I share them in case you need to see them.
So, what could be going on, why from two very similar photos do you get values for R, G and B that do not make sense, why with the other sample does this error not occur?
It is worth to say that analyzing the photos 100 and 101 (where the delivered data go crazy) in the first code (the one that creates the mask) i get similar values for R, G and B, nothing like the ones delivered by the second code. So it is likely that the error has to do with the precision used for the numbers (and not with the code itself, as it was used for the small sample correctly) in addition to the fact that as the color change is more gradual in this large sample, the values from photo to photo are more similar. If the error arises from here, could you help me to correct it? I tried to make some changes but the error persisted, and I’m not very good at programming without the help of AI (my bad).
Thanks in advance!I previously asked this question here. .Since then I have been finding answers little by little to the doubts that have arisen.
In short, I am applying a mask to a series of photos of a sample which is changing color over time. From each of these photos I am measuring the mean R, G and B values within the mask and then transforming them to L, a and b, and finally obtaining the Delta E values between each photo and the first one.
At first, with small samples, everything worked well, and I was able to obtain graphs like the following:
these from samples such as the following:
However, then, using larger samples, I am getting values like the following:
As I said, the only thing I did was to increase the sample size (plus change the time between each photo from about three per second to one per second, and increase the total number of photos by almost 2000).
The origin of the problem seems to be in the measurement of the values of R, G and B, because from these I did the rest of the calculations. For the large sample, where the error occurs, the values of R, G and B go up and down drastically in a strange way from photo 100 to 1800, more or less.
I checked photo 98, 99, 100 and 101 and at first sight they are identical, so the error is not born (apparently) from the analyzed photos.
These are the photos when all start to fail.
I use two codes, the first one (made by Data Analyst, shared by himself in one of the links I put in my first question) to make the mask and verify that it has a correct shape and size. And the second one to apply this mask to each of the photos of the sample and obtain from this process the values of R, G, B, L, a, b and Delta E. Finally, I also use another one to make the graphs. I share them in case you need to see them.
So, what could be going on, why from two very similar photos do you get values for R, G and B that do not make sense, why with the other sample does this error not occur?
It is worth to say that analyzing the photos 100 and 101 (where the delivered data go crazy) in the first code (the one that creates the mask) i get similar values for R, G and B, nothing like the ones delivered by the second code. So it is likely that the error has to do with the precision used for the numbers (and not with the code itself, as it was used for the small sample correctly) in addition to the fact that as the color change is more gradual in this large sample, the values from photo to photo are more similar. If the error arises from here, could you help me to correct it? I tried to make some changes but the error persisted, and I’m not very good at programming without the help of AI (my bad).
Thanks in advance! I previously asked this question here. .Since then I have been finding answers little by little to the doubts that have arisen.
In short, I am applying a mask to a series of photos of a sample which is changing color over time. From each of these photos I am measuring the mean R, G and B values within the mask and then transforming them to L, a and b, and finally obtaining the Delta E values between each photo and the first one.
At first, with small samples, everything worked well, and I was able to obtain graphs like the following:
these from samples such as the following:
However, then, using larger samples, I am getting values like the following:
As I said, the only thing I did was to increase the sample size (plus change the time between each photo from about three per second to one per second, and increase the total number of photos by almost 2000).
The origin of the problem seems to be in the measurement of the values of R, G and B, because from these I did the rest of the calculations. For the large sample, where the error occurs, the values of R, G and B go up and down drastically in a strange way from photo 100 to 1800, more or less.
I checked photo 98, 99, 100 and 101 and at first sight they are identical, so the error is not born (apparently) from the analyzed photos.
These are the photos when all start to fail.
I use two codes, the first one (made by Data Analyst, shared by himself in one of the links I put in my first question) to make the mask and verify that it has a correct shape and size. And the second one to apply this mask to each of the photos of the sample and obtain from this process the values of R, G, B, L, a, b and Delta E. Finally, I also use another one to make the graphs. I share them in case you need to see them.
So, what could be going on, why from two very similar photos do you get values for R, G and B that do not make sense, why with the other sample does this error not occur?
It is worth to say that analyzing the photos 100 and 101 (where the delivered data go crazy) in the first code (the one that creates the mask) i get similar values for R, G and B, nothing like the ones delivered by the second code. So it is likely that the error has to do with the precision used for the numbers (and not with the code itself, as it was used for the small sample correctly) in addition to the fact that as the color change is more gradual in this large sample, the values from photo to photo are more similar. If the error arises from here, could you help me to correct it? I tried to make some changes but the error persisted, and I’m not very good at programming without the help of AI (my bad).
Thanks in advance! image analysis, image processing, image acquisition MATLAB Answers — New Questions
Add together two stem plots
I am trying to add together stem plots. I am getting an error on using + to do this. I am unsure how I am meant to add them together as they work individually. I am trying to take Add1 and Add2 and add them in Total, then take the impulse using yimp and plot that result. Thank you for your time!
%Parameters
fs = 16e3;
t = 0:(1/fs):0.03;
t = t(:); % ensure column vector
numFilts = 32;
filter_number = 10;
range = [50 8000];
gammaFiltBank = gammatoneFilterBank(range,numFilts,fs); % set fs explicity
input_signal = sin(2*pi*100*t) + sin(2*pi*300*t);
output_signal = gammaFiltBank(input_signal);
figure %1
stem(t,output_signal(:,filter_number));
title(‘Output of Filter’, num2str(filter_number))
impulse_input = 0*t;
impulse_input(1) = 1;
reset(gammaFiltBank); % IMPORTANT!
yimp = gammaFiltBank(impulse_input);
%Add together outputs of specific filters
filter_number2=12;
Add1=stem(t,output_signal(:,filter_number));
Add2=stem(t,output_signal(:,filter_number2));
Total=Add1 + Add2;
stem(t,yimp(:,Total))
title(‘Impulse of’, num2str(filter_number), ‘plus’, num2str(filter_number2))I am trying to add together stem plots. I am getting an error on using + to do this. I am unsure how I am meant to add them together as they work individually. I am trying to take Add1 and Add2 and add them in Total, then take the impulse using yimp and plot that result. Thank you for your time!
%Parameters
fs = 16e3;
t = 0:(1/fs):0.03;
t = t(:); % ensure column vector
numFilts = 32;
filter_number = 10;
range = [50 8000];
gammaFiltBank = gammatoneFilterBank(range,numFilts,fs); % set fs explicity
input_signal = sin(2*pi*100*t) + sin(2*pi*300*t);
output_signal = gammaFiltBank(input_signal);
figure %1
stem(t,output_signal(:,filter_number));
title(‘Output of Filter’, num2str(filter_number))
impulse_input = 0*t;
impulse_input(1) = 1;
reset(gammaFiltBank); % IMPORTANT!
yimp = gammaFiltBank(impulse_input);
%Add together outputs of specific filters
filter_number2=12;
Add1=stem(t,output_signal(:,filter_number));
Add2=stem(t,output_signal(:,filter_number2));
Total=Add1 + Add2;
stem(t,yimp(:,Total))
title(‘Impulse of’, num2str(filter_number), ‘plus’, num2str(filter_number2)) I am trying to add together stem plots. I am getting an error on using + to do this. I am unsure how I am meant to add them together as they work individually. I am trying to take Add1 and Add2 and add them in Total, then take the impulse using yimp and plot that result. Thank you for your time!
%Parameters
fs = 16e3;
t = 0:(1/fs):0.03;
t = t(:); % ensure column vector
numFilts = 32;
filter_number = 10;
range = [50 8000];
gammaFiltBank = gammatoneFilterBank(range,numFilts,fs); % set fs explicity
input_signal = sin(2*pi*100*t) + sin(2*pi*300*t);
output_signal = gammaFiltBank(input_signal);
figure %1
stem(t,output_signal(:,filter_number));
title(‘Output of Filter’, num2str(filter_number))
impulse_input = 0*t;
impulse_input(1) = 1;
reset(gammaFiltBank); % IMPORTANT!
yimp = gammaFiltBank(impulse_input);
%Add together outputs of specific filters
filter_number2=12;
Add1=stem(t,output_signal(:,filter_number));
Add2=stem(t,output_signal(:,filter_number2));
Total=Add1 + Add2;
stem(t,yimp(:,Total))
title(‘Impulse of’, num2str(filter_number), ‘plus’, num2str(filter_number2)) stem, plot, addition, plus MATLAB Answers — New Questions
How to merge and smooth multiple curves in a plot, if there are discrete points?
I have a graph, containing 4 different types of curves, in 5 frequency regions, overall 20 curves in a single graph. At some points, the curves meet, however at some points, the curves are super distant from the following one. I applied brushing, but still have discontinuities.
(Keeping the color coding) I need to merge them and smooth the sharp and points. How can I do this?
I uploaded the fig file. I have the excel data if needed.
Best
( 1. I failed to utilize link in figure properties 2. I tried to gather the data in excel, and delete the meeting points, it also didnt work)I have a graph, containing 4 different types of curves, in 5 frequency regions, overall 20 curves in a single graph. At some points, the curves meet, however at some points, the curves are super distant from the following one. I applied brushing, but still have discontinuities.
(Keeping the color coding) I need to merge them and smooth the sharp and points. How can I do this?
I uploaded the fig file. I have the excel data if needed.
Best
( 1. I failed to utilize link in figure properties 2. I tried to gather the data in excel, and delete the meeting points, it also didnt work) I have a graph, containing 4 different types of curves, in 5 frequency regions, overall 20 curves in a single graph. At some points, the curves meet, however at some points, the curves are super distant from the following one. I applied brushing, but still have discontinuities.
(Keeping the color coding) I need to merge them and smooth the sharp and points. How can I do this?
I uploaded the fig file. I have the excel data if needed.
Best
( 1. I failed to utilize link in figure properties 2. I tried to gather the data in excel, and delete the meeting points, it also didnt work) merging curves, smoothing curves, discontinuity solving, managing multiple curves in a single graph MATLAB Answers — New Questions
How can I find water surface temperature from landsat-9 bands?
I would like to find water surface temperature by using Lansat-9 bands.
Thanks in advance,
RiyadhI would like to find water surface temperature by using Lansat-9 bands.
Thanks in advance,
Riyadh I would like to find water surface temperature by using Lansat-9 bands.
Thanks in advance,
Riyadh water surface temperature, using landsat-9 bands MATLAB Answers — New Questions
How to fix “Error using indexing” while calculating differential equations?
syms y(t)
ode = diff(y,t) == t*y
ySol(t) = dsolve(ode)
I copied this example straight from the MatLAB "Solve differential equations" > "First-Order Linear ODE" -example and hoped to modify it to solve my own equation, but it gives me an error message of "Error using indexing: Invalid argument at position 2. Symbolic function expected 1 input arguments but received 2.". I have no clue how to fix it, so help would be kindly appreciated.syms y(t)
ode = diff(y,t) == t*y
ySol(t) = dsolve(ode)
I copied this example straight from the MatLAB "Solve differential equations" > "First-Order Linear ODE" -example and hoped to modify it to solve my own equation, but it gives me an error message of "Error using indexing: Invalid argument at position 2. Symbolic function expected 1 input arguments but received 2.". I have no clue how to fix it, so help would be kindly appreciated. syms y(t)
ode = diff(y,t) == t*y
ySol(t) = dsolve(ode)
I copied this example straight from the MatLAB "Solve differential equations" > "First-Order Linear ODE" -example and hoped to modify it to solve my own equation, but it gives me an error message of "Error using indexing: Invalid argument at position 2. Symbolic function expected 1 input arguments but received 2.". I have no clue how to fix it, so help would be kindly appreciated. indexing, error, differential equations MATLAB Answers — New Questions
setting up infinite sequence and plotting
How do I set up and plot:
Sum (n=0 to infinity) (n^3+1)
Thank youHow do I set up and plot:
Sum (n=0 to infinity) (n^3+1)
Thank you How do I set up and plot:
Sum (n=0 to infinity) (n^3+1)
Thank you infinite sequence, matlab, plotting MATLAB Answers — New Questions
PDE and indefinite integral defining in Matlab
Hello,
I’m setting up the indefinite integral based on time and heat u
Integral t from 0 to infinity (u) * du/dt
How do I set this up and plot it?
Thank you.Hello,
I’m setting up the indefinite integral based on time and heat u
Integral t from 0 to infinity (u) * du/dt
How do I set this up and plot it?
Thank you. Hello,
I’m setting up the indefinite integral based on time and heat u
Integral t from 0 to infinity (u) * du/dt
How do I set this up and plot it?
Thank you. pde, indefinite integral, plotting MATLAB Answers — New Questions
what is the error here?
here is the code .
function slipflow
format long g
%Define all parameters
% Boundary layer thickness & stepsize
etaMin = 0;
etaMax1 = 15;
etaMax2 = 15; %15, 10
stepsize1 = etaMax1;
stepsize2 = etaMax2;
% Input for the parameters
A=1; %velocity slip
B=0.2; %thermal slip
beta=0.02; %heat gen/abs
S=2.4; %suction(2.3,2.4,2.5)
Pr=6.2; %prandtl number
lambda=-1; %stretching shrinking
a=0.01; %phil-1st nanoparticle concentration
b=0.01; %(0.01,0.05)phi2-2nd nanoparticle concentration
c=a+b; %phi-hnf concentration of hybrid nanoparticle
%%%%%%%%%%% 1st nanoparticle properties (Al2O3)%%%%%%%%%%%%
C1=765;
P1=3970;
K1=40;
B1=0.85/((10)^5);
s1=35*(10)^6; %MHD
%%%%%%%%%%% 2nd nanoparticle properties (Cu)%%%%%%%%%%%%
C2=385; %specific heat
P2=8933; %density
K2=400; %thermal conductivity
B2=1.67/((10)^5); %thermal expansion
s2=(59.6)*(10)^6; %MHD
%%%%%%%%%%% Base fluid properties %%%%%%%%%%%%
C3=4179; %specific heat
P3=997.1; %density
K3=0.613; %thermal conductivity
B3=21/((10)^5); %thermal expansion
s3=0.05; %MHD
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%multiplier%%%%%%%%%%%%%%%%%%%
H1=P1*C1; %pho*cp nanoparticle 1
H2=P2*C2; %pho*cp nanoparticle 2
H3=P3*C3; %pho*cp base fluid
H4=a*H1+b*H2+(1-c)*H3; %pho*cp hybrid nanofluid
H5=a*P1+b*P2+(1-c)*P3; %pho hybrid nanofluid
H6=1/((1-c)^2.5); % mu hybrid nanofluid / mu base fluid
H7=a*(P1*B1)+b*(P2*B2)+(1-c)*(P3*B3); % thermal expansion of hybrid nanofluid
%Kn=K3*(K1+2*K3-2*a*(K3-K1))/(K1+2*K3+a*(K3-K1)); %thermal conductivity of nanofluid
Kh=(((a*K1+b*K2)/c)+2*K3+2*(a*K1+b*K2)-2*c*K3)/(((a*K1+b*K2)/c)+2*K3-(a*K1+b*K2)-2*c*K3); %khnf/kf
H8=(((a*s1+b*s2)/c)+2*s3+2*(a*s1+b*s2)-2*c*s3)/(((a*s1+b*s2)/c)+2*s3-(a*s1+b*s2)-2*c*s3); % sigma hnf/ sigma f
D1=(H5/P3)/H6;
D3=(H7/(P3*B3))/(H5/P3); % multiplier of boundary parameter
D2= Pr*((H4/H3)/Kh);
D4=H8/(H5/P3); %multiplier MHD
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% First solution %%%%%%%%%%%%%%%%%%%
options = bvpset(‘stats’,’off’,’RelTol’,1e-10);
solinit = bvpinit (linspace (etaMin, etaMax1, stepsize1),@(x)OdeInit1(x,A,S,lambda));
sol = bvp4c (@(x,y)OdeBVP(x,y,Pr,D1,Kh,H4,H3), @(ya,yb)OdeBC(ya, yb, A, S, lambda), solinit, options);
eta = linspace (etaMin, etaMax1, stepsize1);
y= deval (sol,eta);
figure(1) %velocity profile
plot(sol.x,sol.y(2,:),’-‘)
xlabel(‘eta’)
ylabel(‘f`(eta)’)
hold on
figure(2) %temperature profile
plot(sol.x,sol.y(4,:),’-‘)
xlabel(‘eta’)
ylabel(‘theta(eta)’)
hold on
% saving the out put in text file for first solution
descris =[sol.x; sol.y];
save ‘sliphybrid_upper.txt’ descris -ascii
% Displaying the output for first solution
fprintf(‘n First solution:n’);
fprintf(‘f"(0)=%7.9fn’,y(3)); % reduced skin friction
fprintf(‘-theta(0)=%7.9fn’,-y(5)); %reduced local nusselt number
fprintf(‘Cfx=%7.9fn’,H6*(y(3))); % skin friction
fprintf(‘Nux=%7.9fn’,-Kh*y(5)); % local nusselt number
fprintf(‘n’);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% second solution %%%%%%%%%%%%%%%%%%%
options = bvpset(‘stats’,’off’,’RelTol’,1e-10);
solinit = bvpinit (linspace (etaMin, etaMax2, stepsize2),@(x)OdeInit2(x,A,S,lambda));
sol = bvp4c (@(x,y)OdeBVP(x,y,Pr,D1,Kh,H4,H3), @(ya,yb)OdeBC(ya, yb, A, S, lambda), solinit, options);
eta= linspace (etaMin, etaMax2, stepsize2);
y = deval (sol,eta);
figure(1) %velocity profile
plot(sol.x,sol.y(2,:),’–‘)
xlabel(‘eta’)
ylabel(‘f`(eta)’)
hold on
figure(2) %temperature profile
plot(sol.x,sol.y(4,:),’–‘)
xlabel(‘eta’)
ylabel(‘theta(eta)’)
hold on
% saving the out put in text file for second solution
descris=[sol.x; sol.y];
save ‘sliphybrid_lower.txt’descris -ascii
% Displaying the output for first solution
fprintf(‘nSecond solution:n’);
fprintf(‘f"(0)=%7.9fn’,y(3)); % reduced skin friction
fprintf(‘-theta(0)=%7.9fn’,-y(5)); %reduced local nusselt number
fprintf(‘Cfx=%7.9fn’,H6*(y(3))); % skin friction
fprintf(‘Nux=%7.9fn’,-Kh*y(5)); % local nusselt number
fprintf(‘n’);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
end
% Define the ODE function
function f = OdeBVP(x,y,Pr,D1,Kh,H4,H3)
f =[y(2);y(3);(1/3)*D1*((y(2)^2)-2*(y(1)*y(3))+2*S);y(5);-2/3*(Pr*((H4/H3)/kh)*y(1)*y(5))];
end
% Define the boundary conditions
function res = OdeBC(ya, yb, A, S, lambda)
res= [ya(1)-S;ya(2)-lambda;ya(4)-1;yb(3)-1;yb(4)];
end
% setting the initial guess for first solution
function v = OdeInit1(x,A,S,lambda)
v=[S+0.56;0;0;0;0];
end
% setting the initial guess for second solution
function v1 =OdeInit2(x, A, S,lambda)
v1 = [exp(-x);exp(-x);-exp(-x);-exp(-x);-exp(-x)];
endhere is the code .
function slipflow
format long g
%Define all parameters
% Boundary layer thickness & stepsize
etaMin = 0;
etaMax1 = 15;
etaMax2 = 15; %15, 10
stepsize1 = etaMax1;
stepsize2 = etaMax2;
% Input for the parameters
A=1; %velocity slip
B=0.2; %thermal slip
beta=0.02; %heat gen/abs
S=2.4; %suction(2.3,2.4,2.5)
Pr=6.2; %prandtl number
lambda=-1; %stretching shrinking
a=0.01; %phil-1st nanoparticle concentration
b=0.01; %(0.01,0.05)phi2-2nd nanoparticle concentration
c=a+b; %phi-hnf concentration of hybrid nanoparticle
%%%%%%%%%%% 1st nanoparticle properties (Al2O3)%%%%%%%%%%%%
C1=765;
P1=3970;
K1=40;
B1=0.85/((10)^5);
s1=35*(10)^6; %MHD
%%%%%%%%%%% 2nd nanoparticle properties (Cu)%%%%%%%%%%%%
C2=385; %specific heat
P2=8933; %density
K2=400; %thermal conductivity
B2=1.67/((10)^5); %thermal expansion
s2=(59.6)*(10)^6; %MHD
%%%%%%%%%%% Base fluid properties %%%%%%%%%%%%
C3=4179; %specific heat
P3=997.1; %density
K3=0.613; %thermal conductivity
B3=21/((10)^5); %thermal expansion
s3=0.05; %MHD
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%multiplier%%%%%%%%%%%%%%%%%%%
H1=P1*C1; %pho*cp nanoparticle 1
H2=P2*C2; %pho*cp nanoparticle 2
H3=P3*C3; %pho*cp base fluid
H4=a*H1+b*H2+(1-c)*H3; %pho*cp hybrid nanofluid
H5=a*P1+b*P2+(1-c)*P3; %pho hybrid nanofluid
H6=1/((1-c)^2.5); % mu hybrid nanofluid / mu base fluid
H7=a*(P1*B1)+b*(P2*B2)+(1-c)*(P3*B3); % thermal expansion of hybrid nanofluid
%Kn=K3*(K1+2*K3-2*a*(K3-K1))/(K1+2*K3+a*(K3-K1)); %thermal conductivity of nanofluid
Kh=(((a*K1+b*K2)/c)+2*K3+2*(a*K1+b*K2)-2*c*K3)/(((a*K1+b*K2)/c)+2*K3-(a*K1+b*K2)-2*c*K3); %khnf/kf
H8=(((a*s1+b*s2)/c)+2*s3+2*(a*s1+b*s2)-2*c*s3)/(((a*s1+b*s2)/c)+2*s3-(a*s1+b*s2)-2*c*s3); % sigma hnf/ sigma f
D1=(H5/P3)/H6;
D3=(H7/(P3*B3))/(H5/P3); % multiplier of boundary parameter
D2= Pr*((H4/H3)/Kh);
D4=H8/(H5/P3); %multiplier MHD
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% First solution %%%%%%%%%%%%%%%%%%%
options = bvpset(‘stats’,’off’,’RelTol’,1e-10);
solinit = bvpinit (linspace (etaMin, etaMax1, stepsize1),@(x)OdeInit1(x,A,S,lambda));
sol = bvp4c (@(x,y)OdeBVP(x,y,Pr,D1,Kh,H4,H3), @(ya,yb)OdeBC(ya, yb, A, S, lambda), solinit, options);
eta = linspace (etaMin, etaMax1, stepsize1);
y= deval (sol,eta);
figure(1) %velocity profile
plot(sol.x,sol.y(2,:),’-‘)
xlabel(‘eta’)
ylabel(‘f`(eta)’)
hold on
figure(2) %temperature profile
plot(sol.x,sol.y(4,:),’-‘)
xlabel(‘eta’)
ylabel(‘theta(eta)’)
hold on
% saving the out put in text file for first solution
descris =[sol.x; sol.y];
save ‘sliphybrid_upper.txt’ descris -ascii
% Displaying the output for first solution
fprintf(‘n First solution:n’);
fprintf(‘f"(0)=%7.9fn’,y(3)); % reduced skin friction
fprintf(‘-theta(0)=%7.9fn’,-y(5)); %reduced local nusselt number
fprintf(‘Cfx=%7.9fn’,H6*(y(3))); % skin friction
fprintf(‘Nux=%7.9fn’,-Kh*y(5)); % local nusselt number
fprintf(‘n’);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% second solution %%%%%%%%%%%%%%%%%%%
options = bvpset(‘stats’,’off’,’RelTol’,1e-10);
solinit = bvpinit (linspace (etaMin, etaMax2, stepsize2),@(x)OdeInit2(x,A,S,lambda));
sol = bvp4c (@(x,y)OdeBVP(x,y,Pr,D1,Kh,H4,H3), @(ya,yb)OdeBC(ya, yb, A, S, lambda), solinit, options);
eta= linspace (etaMin, etaMax2, stepsize2);
y = deval (sol,eta);
figure(1) %velocity profile
plot(sol.x,sol.y(2,:),’–‘)
xlabel(‘eta’)
ylabel(‘f`(eta)’)
hold on
figure(2) %temperature profile
plot(sol.x,sol.y(4,:),’–‘)
xlabel(‘eta’)
ylabel(‘theta(eta)’)
hold on
% saving the out put in text file for second solution
descris=[sol.x; sol.y];
save ‘sliphybrid_lower.txt’descris -ascii
% Displaying the output for first solution
fprintf(‘nSecond solution:n’);
fprintf(‘f"(0)=%7.9fn’,y(3)); % reduced skin friction
fprintf(‘-theta(0)=%7.9fn’,-y(5)); %reduced local nusselt number
fprintf(‘Cfx=%7.9fn’,H6*(y(3))); % skin friction
fprintf(‘Nux=%7.9fn’,-Kh*y(5)); % local nusselt number
fprintf(‘n’);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
end
% Define the ODE function
function f = OdeBVP(x,y,Pr,D1,Kh,H4,H3)
f =[y(2);y(3);(1/3)*D1*((y(2)^2)-2*(y(1)*y(3))+2*S);y(5);-2/3*(Pr*((H4/H3)/kh)*y(1)*y(5))];
end
% Define the boundary conditions
function res = OdeBC(ya, yb, A, S, lambda)
res= [ya(1)-S;ya(2)-lambda;ya(4)-1;yb(3)-1;yb(4)];
end
% setting the initial guess for first solution
function v = OdeInit1(x,A,S,lambda)
v=[S+0.56;0;0;0;0];
end
% setting the initial guess for second solution
function v1 =OdeInit2(x, A, S,lambda)
v1 = [exp(-x);exp(-x);-exp(-x);-exp(-x);-exp(-x)];
end here is the code .
function slipflow
format long g
%Define all parameters
% Boundary layer thickness & stepsize
etaMin = 0;
etaMax1 = 15;
etaMax2 = 15; %15, 10
stepsize1 = etaMax1;
stepsize2 = etaMax2;
% Input for the parameters
A=1; %velocity slip
B=0.2; %thermal slip
beta=0.02; %heat gen/abs
S=2.4; %suction(2.3,2.4,2.5)
Pr=6.2; %prandtl number
lambda=-1; %stretching shrinking
a=0.01; %phil-1st nanoparticle concentration
b=0.01; %(0.01,0.05)phi2-2nd nanoparticle concentration
c=a+b; %phi-hnf concentration of hybrid nanoparticle
%%%%%%%%%%% 1st nanoparticle properties (Al2O3)%%%%%%%%%%%%
C1=765;
P1=3970;
K1=40;
B1=0.85/((10)^5);
s1=35*(10)^6; %MHD
%%%%%%%%%%% 2nd nanoparticle properties (Cu)%%%%%%%%%%%%
C2=385; %specific heat
P2=8933; %density
K2=400; %thermal conductivity
B2=1.67/((10)^5); %thermal expansion
s2=(59.6)*(10)^6; %MHD
%%%%%%%%%%% Base fluid properties %%%%%%%%%%%%
C3=4179; %specific heat
P3=997.1; %density
K3=0.613; %thermal conductivity
B3=21/((10)^5); %thermal expansion
s3=0.05; %MHD
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%multiplier%%%%%%%%%%%%%%%%%%%
H1=P1*C1; %pho*cp nanoparticle 1
H2=P2*C2; %pho*cp nanoparticle 2
H3=P3*C3; %pho*cp base fluid
H4=a*H1+b*H2+(1-c)*H3; %pho*cp hybrid nanofluid
H5=a*P1+b*P2+(1-c)*P3; %pho hybrid nanofluid
H6=1/((1-c)^2.5); % mu hybrid nanofluid / mu base fluid
H7=a*(P1*B1)+b*(P2*B2)+(1-c)*(P3*B3); % thermal expansion of hybrid nanofluid
%Kn=K3*(K1+2*K3-2*a*(K3-K1))/(K1+2*K3+a*(K3-K1)); %thermal conductivity of nanofluid
Kh=(((a*K1+b*K2)/c)+2*K3+2*(a*K1+b*K2)-2*c*K3)/(((a*K1+b*K2)/c)+2*K3-(a*K1+b*K2)-2*c*K3); %khnf/kf
H8=(((a*s1+b*s2)/c)+2*s3+2*(a*s1+b*s2)-2*c*s3)/(((a*s1+b*s2)/c)+2*s3-(a*s1+b*s2)-2*c*s3); % sigma hnf/ sigma f
D1=(H5/P3)/H6;
D3=(H7/(P3*B3))/(H5/P3); % multiplier of boundary parameter
D2= Pr*((H4/H3)/Kh);
D4=H8/(H5/P3); %multiplier MHD
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% First solution %%%%%%%%%%%%%%%%%%%
options = bvpset(‘stats’,’off’,’RelTol’,1e-10);
solinit = bvpinit (linspace (etaMin, etaMax1, stepsize1),@(x)OdeInit1(x,A,S,lambda));
sol = bvp4c (@(x,y)OdeBVP(x,y,Pr,D1,Kh,H4,H3), @(ya,yb)OdeBC(ya, yb, A, S, lambda), solinit, options);
eta = linspace (etaMin, etaMax1, stepsize1);
y= deval (sol,eta);
figure(1) %velocity profile
plot(sol.x,sol.y(2,:),’-‘)
xlabel(‘eta’)
ylabel(‘f`(eta)’)
hold on
figure(2) %temperature profile
plot(sol.x,sol.y(4,:),’-‘)
xlabel(‘eta’)
ylabel(‘theta(eta)’)
hold on
% saving the out put in text file for first solution
descris =[sol.x; sol.y];
save ‘sliphybrid_upper.txt’ descris -ascii
% Displaying the output for first solution
fprintf(‘n First solution:n’);
fprintf(‘f"(0)=%7.9fn’,y(3)); % reduced skin friction
fprintf(‘-theta(0)=%7.9fn’,-y(5)); %reduced local nusselt number
fprintf(‘Cfx=%7.9fn’,H6*(y(3))); % skin friction
fprintf(‘Nux=%7.9fn’,-Kh*y(5)); % local nusselt number
fprintf(‘n’);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% second solution %%%%%%%%%%%%%%%%%%%
options = bvpset(‘stats’,’off’,’RelTol’,1e-10);
solinit = bvpinit (linspace (etaMin, etaMax2, stepsize2),@(x)OdeInit2(x,A,S,lambda));
sol = bvp4c (@(x,y)OdeBVP(x,y,Pr,D1,Kh,H4,H3), @(ya,yb)OdeBC(ya, yb, A, S, lambda), solinit, options);
eta= linspace (etaMin, etaMax2, stepsize2);
y = deval (sol,eta);
figure(1) %velocity profile
plot(sol.x,sol.y(2,:),’–‘)
xlabel(‘eta’)
ylabel(‘f`(eta)’)
hold on
figure(2) %temperature profile
plot(sol.x,sol.y(4,:),’–‘)
xlabel(‘eta’)
ylabel(‘theta(eta)’)
hold on
% saving the out put in text file for second solution
descris=[sol.x; sol.y];
save ‘sliphybrid_lower.txt’descris -ascii
% Displaying the output for first solution
fprintf(‘nSecond solution:n’);
fprintf(‘f"(0)=%7.9fn’,y(3)); % reduced skin friction
fprintf(‘-theta(0)=%7.9fn’,-y(5)); %reduced local nusselt number
fprintf(‘Cfx=%7.9fn’,H6*(y(3))); % skin friction
fprintf(‘Nux=%7.9fn’,-Kh*y(5)); % local nusselt number
fprintf(‘n’);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
end
% Define the ODE function
function f = OdeBVP(x,y,Pr,D1,Kh,H4,H3)
f =[y(2);y(3);(1/3)*D1*((y(2)^2)-2*(y(1)*y(3))+2*S);y(5);-2/3*(Pr*((H4/H3)/kh)*y(1)*y(5))];
end
% Define the boundary conditions
function res = OdeBC(ya, yb, A, S, lambda)
res= [ya(1)-S;ya(2)-lambda;ya(4)-1;yb(3)-1;yb(4)];
end
% setting the initial guess for first solution
function v = OdeInit1(x,A,S,lambda)
v=[S+0.56;0;0;0;0];
end
% setting the initial guess for second solution
function v1 =OdeInit2(x, A, S,lambda)
v1 = [exp(-x);exp(-x);-exp(-x);-exp(-x);-exp(-x)];
end matlab MATLAB Answers — New Questions
Sort columns of a table by the value corresponding
Ive attached a sc of my table, although it continues to 86 columns, I would like to sort the values corresponding to each variable in decending order, and have the variable names be sorted along with the value.
The table dimensions is 1×86 as seen in the screenshotIve attached a sc of my table, although it continues to 86 columns, I would like to sort the values corresponding to each variable in decending order, and have the variable names be sorted along with the value.
The table dimensions is 1×86 as seen in the screenshot Ive attached a sc of my table, although it continues to 86 columns, I would like to sort the values corresponding to each variable in decending order, and have the variable names be sorted along with the value.
The table dimensions is 1×86 as seen in the screenshot table, sort MATLAB Answers — New Questions
FFT multiple input waves and plot on same graph
I am trying to plot the fft of multiple input waves on the same graph. The input epquation is the same but I want varying A values (A1,A2,…An) and varying freq values (freq1,freq2,…,freqn). I want to first plot these equations all on one graph, and plot all of the ffts of these inputs on another plot. This is what I have, I feel that there is a more efficient/better way to do this, as I want to have about 10 inputs. Thank you for your time!
%% Input Signal
fs = 20e3;
numFilts = 32; %
filter_number = numFilts;
freq1 = 1000; % Hz
Nperiods = 15; % we need more than 1 period of signal to reach the steady state output (look a the IR samples)
t = linspace(0,Nperiods/freq1,200*Nperiods); %
A1=1;
input1 = A1*sin(2*pi*freq1*t) + 0*rand(size(t));
A2=3;
freq2=2000;
input2 = A2*sin(2*pi*freq2*t) + 0*rand(size(t));
%FFT Input
FFT_Input1=fft(input1);
plot(t,FFT_Input1)
FFT_Input2=fft(input2);
plot(t,FFT_Input2)I am trying to plot the fft of multiple input waves on the same graph. The input epquation is the same but I want varying A values (A1,A2,…An) and varying freq values (freq1,freq2,…,freqn). I want to first plot these equations all on one graph, and plot all of the ffts of these inputs on another plot. This is what I have, I feel that there is a more efficient/better way to do this, as I want to have about 10 inputs. Thank you for your time!
%% Input Signal
fs = 20e3;
numFilts = 32; %
filter_number = numFilts;
freq1 = 1000; % Hz
Nperiods = 15; % we need more than 1 period of signal to reach the steady state output (look a the IR samples)
t = linspace(0,Nperiods/freq1,200*Nperiods); %
A1=1;
input1 = A1*sin(2*pi*freq1*t) + 0*rand(size(t));
A2=3;
freq2=2000;
input2 = A2*sin(2*pi*freq2*t) + 0*rand(size(t));
%FFT Input
FFT_Input1=fft(input1);
plot(t,FFT_Input1)
FFT_Input2=fft(input2);
plot(t,FFT_Input2) I am trying to plot the fft of multiple input waves on the same graph. The input epquation is the same but I want varying A values (A1,A2,…An) and varying freq values (freq1,freq2,…,freqn). I want to first plot these equations all on one graph, and plot all of the ffts of these inputs on another plot. This is what I have, I feel that there is a more efficient/better way to do this, as I want to have about 10 inputs. Thank you for your time!
%% Input Signal
fs = 20e3;
numFilts = 32; %
filter_number = numFilts;
freq1 = 1000; % Hz
Nperiods = 15; % we need more than 1 period of signal to reach the steady state output (look a the IR samples)
t = linspace(0,Nperiods/freq1,200*Nperiods); %
A1=1;
input1 = A1*sin(2*pi*freq1*t) + 0*rand(size(t));
A2=3;
freq2=2000;
input2 = A2*sin(2*pi*freq2*t) + 0*rand(size(t));
%FFT Input
FFT_Input1=fft(input1);
plot(t,FFT_Input1)
FFT_Input2=fft(input2);
plot(t,FFT_Input2) fft, plot MATLAB Answers — New Questions
Building a survey GUI that records the answers of different study participants
Hello everyone,
I’m pretty new to MATLAB and was hoping if I could get some advice. I’m trying to build a MATLAB GUI for a study where I want the participants to listen to multiple audio files and give ratings for each (by slider values). I plan on deploying a web app and making it available on the Web Server so that pariticipants (that don’t have MATLAB) can access a link and send in their anonymous responses. I would like these responses to be saved in an excel sheet for all participants for analysis later.
I haven’t reached the deployment stage of this GUI (currently waiting on a license for Web Server access), but I was wondering if anyone had any suggestions when it comes to building a participant survery in MATLAB. Additionally, if anyone has an pariticipant survey scripts that already do that, I would really appreciate it if you could share it with me!Hello everyone,
I’m pretty new to MATLAB and was hoping if I could get some advice. I’m trying to build a MATLAB GUI for a study where I want the participants to listen to multiple audio files and give ratings for each (by slider values). I plan on deploying a web app and making it available on the Web Server so that pariticipants (that don’t have MATLAB) can access a link and send in their anonymous responses. I would like these responses to be saved in an excel sheet for all participants for analysis later.
I haven’t reached the deployment stage of this GUI (currently waiting on a license for Web Server access), but I was wondering if anyone had any suggestions when it comes to building a participant survery in MATLAB. Additionally, if anyone has an pariticipant survey scripts that already do that, I would really appreciate it if you could share it with me! Hello everyone,
I’m pretty new to MATLAB and was hoping if I could get some advice. I’m trying to build a MATLAB GUI for a study where I want the participants to listen to multiple audio files and give ratings for each (by slider values). I plan on deploying a web app and making it available on the Web Server so that pariticipants (that don’t have MATLAB) can access a link and send in their anonymous responses. I would like these responses to be saved in an excel sheet for all participants for analysis later.
I haven’t reached the deployment stage of this GUI (currently waiting on a license for Web Server access), but I was wondering if anyone had any suggestions when it comes to building a participant survery in MATLAB. Additionally, if anyone has an pariticipant survey scripts that already do that, I would really appreciate it if you could share it with me! data acquisition MATLAB Answers — New Questions
Error in opening MATLAB device file for LED trigger source.
Hi, I am using the ‘MATLAB support package for Raspberry Pi hardware’ using MATLAB 2023a. I have installed all the necessary files on the Pi. I began following the tutorial here:
Getting Started with MATLAB Support Package for Raspberry Pi Hardware – MATLAB & Simulink Example – MathWorks United Kingdom
I got to the first step, ran the code
rpi = raspi(‘IP Address’,’username’,’password’);
and was met with the following error (Practice_1 is the name of the script):
Error using Practice_1
Cannot open the device file for LED trigger source.
Any help please? I followed the tutorials accurately on the MathWorks websiteHi, I am using the ‘MATLAB support package for Raspberry Pi hardware’ using MATLAB 2023a. I have installed all the necessary files on the Pi. I began following the tutorial here:
Getting Started with MATLAB Support Package for Raspberry Pi Hardware – MATLAB & Simulink Example – MathWorks United Kingdom
I got to the first step, ran the code
rpi = raspi(‘IP Address’,’username’,’password’);
and was met with the following error (Practice_1 is the name of the script):
Error using Practice_1
Cannot open the device file for LED trigger source.
Any help please? I followed the tutorials accurately on the MathWorks website Hi, I am using the ‘MATLAB support package for Raspberry Pi hardware’ using MATLAB 2023a. I have installed all the necessary files on the Pi. I began following the tutorial here:
Getting Started with MATLAB Support Package for Raspberry Pi Hardware – MATLAB & Simulink Example – MathWorks United Kingdom
I got to the first step, ran the code
rpi = raspi(‘IP Address’,’username’,’password’);
and was met with the following error (Practice_1 is the name of the script):
Error using Practice_1
Cannot open the device file for LED trigger source.
Any help please? I followed the tutorials accurately on the MathWorks website raspberry pi, hardware, add-ons, led MATLAB Answers — New Questions
Implicit plot with multi variable assumptions (symbolic math)
Hello,
I have to plot the following problem in symbolic form:
x*y + constant > 0 if x + y – constant2 > 0
i have used fimplicit and assume for the other condition but two problems arise: assume only seems to read one variable while fimplicit doesn’t seem to work with assumptions.
Can anybody give me any helpful suggestion?
thank youHello,
I have to plot the following problem in symbolic form:
x*y + constant > 0 if x + y – constant2 > 0
i have used fimplicit and assume for the other condition but two problems arise: assume only seems to read one variable while fimplicit doesn’t seem to work with assumptions.
Can anybody give me any helpful suggestion?
thank you Hello,
I have to plot the following problem in symbolic form:
x*y + constant > 0 if x + y – constant2 > 0
i have used fimplicit and assume for the other condition but two problems arise: assume only seems to read one variable while fimplicit doesn’t seem to work with assumptions.
Can anybody give me any helpful suggestion?
thank you symbolic math, fimplicit, assume, plotting MATLAB Answers — New Questions
Can I adjust the hyperparameters when using the Classification Learner app?
I already read how to adjust hyperparameters from this website: https://www.mathworks.com/help/stats/train-classifier-using-hyperparameter-optimization-in-classification-learner-app.html, however, I seem to be unable to adjust the hyperparameters. Is this due to a difference in MATLAB versions?I already read how to adjust hyperparameters from this website: https://www.mathworks.com/help/stats/train-classifier-using-hyperparameter-optimization-in-classification-learner-app.html, however, I seem to be unable to adjust the hyperparameters. Is this due to a difference in MATLAB versions? I already read how to adjust hyperparameters from this website: https://www.mathworks.com/help/stats/train-classifier-using-hyperparameter-optimization-in-classification-learner-app.html, however, I seem to be unable to adjust the hyperparameters. Is this due to a difference in MATLAB versions? toolbox, classification, hyperparameters MATLAB Answers — New Questions
Curve fitting with loop
Hi all, I have multiple sets of data to be fitted using a custom fitting function. I would like to do it such that I will only have to provide one initial guess for the first set of data, and after the computer managed to get the solution of the parameters for the first set of data, it will use the solution of the first set of data as the initial guess for the second set of data, so on and forth.
I have attached my data and code for the fitting:
%% Preparation
clear;clc
%data = importdata("Experimental dataTransient AbsorptionFCPIB-293K-2.5mW-400nm-Jan072021 -ibg -bg -chirp.csv"); % insert file path within parenthesis
data = importdata("FCPIB-293K-2.5mW-400nm-Jan072021 -ibg -bg -chirp.csv"); % insert file path within parenthesis
%% Preamble
% Fundamental constants
h = 4.0135667696*10^-15; % units: eV/ Hz
c = 3*10^8; % SI units
kB = 8.617333268*10^-5; % units: eV/ K
% Clean up of data to select range of values
wavelength = data(1:end, 1);
delay_t = data(1, 1:end); % conatains all of the delay times
E = (h*c)./(wavelength*10^-9); % contains all of the probe energies
Range_E = E>=1.5 & E<=2.2;
Range_T = delay_t>=0.5 & delay_t<=1000;
% for one delay time
T = find(Range_T);
T_min = min(T);
T_max = max(T);
t = min(T); % choose an integer b/w T_min and T_max
delaytime = delay_t(1, t);
% Data for fitting
E_p = E(Range_E); % selected probe energies
delta_Abs = -1*data(Range_E,t);
delta_Abs_norm = delta_Abs./max(delta_Abs); % normalised delta_Abs
Range_Efit = E_p>=1.65 & E_p<=max(E_p);
E_fit = E_p(Range_Efit);
delta_Abs_norm_fit = delta_Abs_norm(Range_Efit);
% Fitting function
function F = MB(y, E_fit)
F = y(1).*exp(-(E_fit./(8.617333268*10^-5.*y(2)))) + y(3);
end
%% Curve fitting options
% Initial parameter guess and bounds
lb = [0, 293, -Inf]; ub = [Inf, Inf, Inf];
y0 = [4*10^7, 900, 2];
% lsqcurvefit and choose between different algorithm that lsqcurvefit employs (3C1, comment those lines that are not choosen and uncomment the line that is choosen, if not, matlab will take the last line of "optim_lsq" by default)
% optim_lsq = optimoptions(‘lsqcurvefit’, ‘Algorithm’, ‘levenberg-marquardt’, ‘MaxFunctionEvaluations’,10^5, ‘MaxIterations’, 10^5, ‘FunctionTolerance’,10^-10, ‘StepTolerance’, 10^-10);
optim_lsq = optimoptions(‘lsqcurvefit’, ‘Algorithm’, ‘trust-region-reflective’, ‘MaxFunctionEvaluations’,10^5, ‘MaxIterations’,10^5, ‘FunctionTolerance’,10^-20, ‘StepTolerance’, 10^-20);
% optim_lsq = optimoptions(‘lsqcurvefit’, ‘Algorithm’, ‘interior-point’, ‘MaxFunctionEvaluations’,1000, ‘MaxIterations’, 1000, ‘FunctionTolerance’,10^-20, ‘StepTolerance’, 10^-20);
% Solver for lsqcurvefit
[y, residualnorm, residual, exitflag, output, lambda, jacobian] = lsqcurvefit(@MB, y0, E_fit, delta_Abs_norm_fit, lb, ub);
%% Error bars calculation
ci = nlparci(y, residual, ‘Jacobian’, jacobian);
PCI = table(ci(:,1), y(:), ci(:,2),’VariableNames’,{‘CI 0.025′,’y’,’CI 0.975′});
Parameter_CI = table2array(PCI);
upper_bar = (Parameter_CI(:,3) – Parameter_CI(:,2))./2;
lower_bar = (Parameter_CI(:,2) – Parameter_CI(:,1))./2;
%% Plot command
plot(E_p, delta_Abs_norm,’Black’)
hold on
plot(E_fit, MB(y, E_fit), ‘LineWidth’, 1.0, ‘Color’, ‘red’)
xlabel(‘Probe Photon Energy (eV)’)
ylabel(‘Normalised Delta A (a.u.)’)
legend(‘Experimental Data’, ‘Fitted Curve’)
Some background info regarding the data:
There’s a range of values in the first column and these corresponds to this quantity called wavelength. After I have extracted the wavelength from there, I’ll process it into this quantitiy call E. However, E takes a range of values and I’ll only need the values ranging from E = 1.5 to E = 2.2 (this is the data used for the scatterplot, it is named as E_p in my code)
After the first step is done, I’ll now need to choose the range of E_p (E_p = 1.65 to E_p = 2.2) for the fitting of my data (this is named as E_fit in my code) note: the range of values for fitting range of values for scatter plot
Subsequently, I’ll need to look at the first row of my data and select some of them (they need to be positive). Once I have selected them, I’ll need to select the data in the same column as them and this needs to correspond to both E_p and E_fit.
In conclusion, the data selected in 1. and 2. goes to the horizontal axis and the data selected in 3. goes to the vertical axis.
Thank you.Hi all, I have multiple sets of data to be fitted using a custom fitting function. I would like to do it such that I will only have to provide one initial guess for the first set of data, and after the computer managed to get the solution of the parameters for the first set of data, it will use the solution of the first set of data as the initial guess for the second set of data, so on and forth.
I have attached my data and code for the fitting:
%% Preparation
clear;clc
%data = importdata("Experimental dataTransient AbsorptionFCPIB-293K-2.5mW-400nm-Jan072021 -ibg -bg -chirp.csv"); % insert file path within parenthesis
data = importdata("FCPIB-293K-2.5mW-400nm-Jan072021 -ibg -bg -chirp.csv"); % insert file path within parenthesis
%% Preamble
% Fundamental constants
h = 4.0135667696*10^-15; % units: eV/ Hz
c = 3*10^8; % SI units
kB = 8.617333268*10^-5; % units: eV/ K
% Clean up of data to select range of values
wavelength = data(1:end, 1);
delay_t = data(1, 1:end); % conatains all of the delay times
E = (h*c)./(wavelength*10^-9); % contains all of the probe energies
Range_E = E>=1.5 & E<=2.2;
Range_T = delay_t>=0.5 & delay_t<=1000;
% for one delay time
T = find(Range_T);
T_min = min(T);
T_max = max(T);
t = min(T); % choose an integer b/w T_min and T_max
delaytime = delay_t(1, t);
% Data for fitting
E_p = E(Range_E); % selected probe energies
delta_Abs = -1*data(Range_E,t);
delta_Abs_norm = delta_Abs./max(delta_Abs); % normalised delta_Abs
Range_Efit = E_p>=1.65 & E_p<=max(E_p);
E_fit = E_p(Range_Efit);
delta_Abs_norm_fit = delta_Abs_norm(Range_Efit);
% Fitting function
function F = MB(y, E_fit)
F = y(1).*exp(-(E_fit./(8.617333268*10^-5.*y(2)))) + y(3);
end
%% Curve fitting options
% Initial parameter guess and bounds
lb = [0, 293, -Inf]; ub = [Inf, Inf, Inf];
y0 = [4*10^7, 900, 2];
% lsqcurvefit and choose between different algorithm that lsqcurvefit employs (3C1, comment those lines that are not choosen and uncomment the line that is choosen, if not, matlab will take the last line of "optim_lsq" by default)
% optim_lsq = optimoptions(‘lsqcurvefit’, ‘Algorithm’, ‘levenberg-marquardt’, ‘MaxFunctionEvaluations’,10^5, ‘MaxIterations’, 10^5, ‘FunctionTolerance’,10^-10, ‘StepTolerance’, 10^-10);
optim_lsq = optimoptions(‘lsqcurvefit’, ‘Algorithm’, ‘trust-region-reflective’, ‘MaxFunctionEvaluations’,10^5, ‘MaxIterations’,10^5, ‘FunctionTolerance’,10^-20, ‘StepTolerance’, 10^-20);
% optim_lsq = optimoptions(‘lsqcurvefit’, ‘Algorithm’, ‘interior-point’, ‘MaxFunctionEvaluations’,1000, ‘MaxIterations’, 1000, ‘FunctionTolerance’,10^-20, ‘StepTolerance’, 10^-20);
% Solver for lsqcurvefit
[y, residualnorm, residual, exitflag, output, lambda, jacobian] = lsqcurvefit(@MB, y0, E_fit, delta_Abs_norm_fit, lb, ub);
%% Error bars calculation
ci = nlparci(y, residual, ‘Jacobian’, jacobian);
PCI = table(ci(:,1), y(:), ci(:,2),’VariableNames’,{‘CI 0.025′,’y’,’CI 0.975′});
Parameter_CI = table2array(PCI);
upper_bar = (Parameter_CI(:,3) – Parameter_CI(:,2))./2;
lower_bar = (Parameter_CI(:,2) – Parameter_CI(:,1))./2;
%% Plot command
plot(E_p, delta_Abs_norm,’Black’)
hold on
plot(E_fit, MB(y, E_fit), ‘LineWidth’, 1.0, ‘Color’, ‘red’)
xlabel(‘Probe Photon Energy (eV)’)
ylabel(‘Normalised Delta A (a.u.)’)
legend(‘Experimental Data’, ‘Fitted Curve’)
Some background info regarding the data:
There’s a range of values in the first column and these corresponds to this quantity called wavelength. After I have extracted the wavelength from there, I’ll process it into this quantitiy call E. However, E takes a range of values and I’ll only need the values ranging from E = 1.5 to E = 2.2 (this is the data used for the scatterplot, it is named as E_p in my code)
After the first step is done, I’ll now need to choose the range of E_p (E_p = 1.65 to E_p = 2.2) for the fitting of my data (this is named as E_fit in my code) note: the range of values for fitting range of values for scatter plot
Subsequently, I’ll need to look at the first row of my data and select some of them (they need to be positive). Once I have selected them, I’ll need to select the data in the same column as them and this needs to correspond to both E_p and E_fit.
In conclusion, the data selected in 1. and 2. goes to the horizontal axis and the data selected in 3. goes to the vertical axis.
Thank you. Hi all, I have multiple sets of data to be fitted using a custom fitting function. I would like to do it such that I will only have to provide one initial guess for the first set of data, and after the computer managed to get the solution of the parameters for the first set of data, it will use the solution of the first set of data as the initial guess for the second set of data, so on and forth.
I have attached my data and code for the fitting:
%% Preparation
clear;clc
%data = importdata("Experimental dataTransient AbsorptionFCPIB-293K-2.5mW-400nm-Jan072021 -ibg -bg -chirp.csv"); % insert file path within parenthesis
data = importdata("FCPIB-293K-2.5mW-400nm-Jan072021 -ibg -bg -chirp.csv"); % insert file path within parenthesis
%% Preamble
% Fundamental constants
h = 4.0135667696*10^-15; % units: eV/ Hz
c = 3*10^8; % SI units
kB = 8.617333268*10^-5; % units: eV/ K
% Clean up of data to select range of values
wavelength = data(1:end, 1);
delay_t = data(1, 1:end); % conatains all of the delay times
E = (h*c)./(wavelength*10^-9); % contains all of the probe energies
Range_E = E>=1.5 & E<=2.2;
Range_T = delay_t>=0.5 & delay_t<=1000;
% for one delay time
T = find(Range_T);
T_min = min(T);
T_max = max(T);
t = min(T); % choose an integer b/w T_min and T_max
delaytime = delay_t(1, t);
% Data for fitting
E_p = E(Range_E); % selected probe energies
delta_Abs = -1*data(Range_E,t);
delta_Abs_norm = delta_Abs./max(delta_Abs); % normalised delta_Abs
Range_Efit = E_p>=1.65 & E_p<=max(E_p);
E_fit = E_p(Range_Efit);
delta_Abs_norm_fit = delta_Abs_norm(Range_Efit);
% Fitting function
function F = MB(y, E_fit)
F = y(1).*exp(-(E_fit./(8.617333268*10^-5.*y(2)))) + y(3);
end
%% Curve fitting options
% Initial parameter guess and bounds
lb = [0, 293, -Inf]; ub = [Inf, Inf, Inf];
y0 = [4*10^7, 900, 2];
% lsqcurvefit and choose between different algorithm that lsqcurvefit employs (3C1, comment those lines that are not choosen and uncomment the line that is choosen, if not, matlab will take the last line of "optim_lsq" by default)
% optim_lsq = optimoptions(‘lsqcurvefit’, ‘Algorithm’, ‘levenberg-marquardt’, ‘MaxFunctionEvaluations’,10^5, ‘MaxIterations’, 10^5, ‘FunctionTolerance’,10^-10, ‘StepTolerance’, 10^-10);
optim_lsq = optimoptions(‘lsqcurvefit’, ‘Algorithm’, ‘trust-region-reflective’, ‘MaxFunctionEvaluations’,10^5, ‘MaxIterations’,10^5, ‘FunctionTolerance’,10^-20, ‘StepTolerance’, 10^-20);
% optim_lsq = optimoptions(‘lsqcurvefit’, ‘Algorithm’, ‘interior-point’, ‘MaxFunctionEvaluations’,1000, ‘MaxIterations’, 1000, ‘FunctionTolerance’,10^-20, ‘StepTolerance’, 10^-20);
% Solver for lsqcurvefit
[y, residualnorm, residual, exitflag, output, lambda, jacobian] = lsqcurvefit(@MB, y0, E_fit, delta_Abs_norm_fit, lb, ub);
%% Error bars calculation
ci = nlparci(y, residual, ‘Jacobian’, jacobian);
PCI = table(ci(:,1), y(:), ci(:,2),’VariableNames’,{‘CI 0.025′,’y’,’CI 0.975′});
Parameter_CI = table2array(PCI);
upper_bar = (Parameter_CI(:,3) – Parameter_CI(:,2))./2;
lower_bar = (Parameter_CI(:,2) – Parameter_CI(:,1))./2;
%% Plot command
plot(E_p, delta_Abs_norm,’Black’)
hold on
plot(E_fit, MB(y, E_fit), ‘LineWidth’, 1.0, ‘Color’, ‘red’)
xlabel(‘Probe Photon Energy (eV)’)
ylabel(‘Normalised Delta A (a.u.)’)
legend(‘Experimental Data’, ‘Fitted Curve’)
Some background info regarding the data:
There’s a range of values in the first column and these corresponds to this quantity called wavelength. After I have extracted the wavelength from there, I’ll process it into this quantitiy call E. However, E takes a range of values and I’ll only need the values ranging from E = 1.5 to E = 2.2 (this is the data used for the scatterplot, it is named as E_p in my code)
After the first step is done, I’ll now need to choose the range of E_p (E_p = 1.65 to E_p = 2.2) for the fitting of my data (this is named as E_fit in my code) note: the range of values for fitting range of values for scatter plot
Subsequently, I’ll need to look at the first row of my data and select some of them (they need to be positive). Once I have selected them, I’ll need to select the data in the same column as them and this needs to correspond to both E_p and E_fit.
In conclusion, the data selected in 1. and 2. goes to the horizontal axis and the data selected in 3. goes to the vertical axis.
Thank you. curve fitting MATLAB Answers — New Questions
plutosdr get chan error
hello I am tring to use matlab with ad9363+ zynq ,the firmware is plutosdr v0.38 built by myself,the iio version is v0.25
the matlab code is
warning(‘off’,’plutoradio:sysobj:FirmwareIncompatible’);
%%ad9361配置
tx = sdrtx(‘AD936x’,…
‘IPAddress’,’192.168.5.23′,…
‘ChannelMapping’,1)
radioSettings = info(tx)
tx.CenterFrequency = 2.415e9;
tx.BasebandSampleRate = 2e6;
tx.Gain = -5;
%% 信号波形设置
sw = dsp.SineWave;
sw.Amplitude = 0.5;
sw.Frequency = 100e3;
sw.ComplexOutput = true;
sw.SampleRate = tx.BasebandSampleRate;
sw.SamplesPerFrame = 1000;
txWaveform = sw();
%%发送信号
transmitRepeat(tx,txWaveform)
release(tx);
the error is
包含以下字段的 struct:
Status: ‘Unable to setup device’
MsgDetails: ‘Channel: altvoltage4 not found.’
11 tx.CenterFrequency = 2.415e9;
## Establishing connection to hardware. This process can take several seconds.
错误使用 matlabshared.libiio.base/cstatusid
Channel: altvoltage4 not found.
出错 matlabshared.libiio.base/getChan
出错 comm.libiio.AD9361.tx_control/setupDDSChannel
出错 comm.libiio.AD9361.tx_control/SetupDDS
出错 comm.libiio.AD9361.tx_control/sdrDevPreInit
出错 comm.libiio.AD9361.tx/sdrDevPreInit
出错 comm.zynqradioshared.tx/sdrDevPreInit
出错 comm.libiio.AD9361.base_control/configureChanBuffers
出错 comm.libiio.AD9361.base/configureChanBuffers
出错 matlabshared.libiio.base/setupImpl
出错 comm.libiio.AD9361.base_control/setupImpl
出错 comm.libiio.AD9361.base/setupImpl
出错 comm.libiio.AD9361.tx_control/setupImpl
出错 comm.libiio.AD9361.tx/setupImpl
出错 comm.zynqradioshared.tx/setupImpl
出错 comm.libiio.AD9361.tx/transmitRepeat
出错 Untitled (第 28 行)
transmitRepeat(tx,txWaveform)
but I think the firmware is ok because I test it on GNU Radio and ADI IIO Osi they both work.
when I swith the sdrtx(‘AD936x’ to sdrtx(‘pluto’,I get the error
The radio with ID usb:0 is already owned by a block,hello I am tring to use matlab with ad9363+ zynq ,the firmware is plutosdr v0.38 built by myself,the iio version is v0.25
the matlab code is
warning(‘off’,’plutoradio:sysobj:FirmwareIncompatible’);
%%ad9361配置
tx = sdrtx(‘AD936x’,…
‘IPAddress’,’192.168.5.23′,…
‘ChannelMapping’,1)
radioSettings = info(tx)
tx.CenterFrequency = 2.415e9;
tx.BasebandSampleRate = 2e6;
tx.Gain = -5;
%% 信号波形设置
sw = dsp.SineWave;
sw.Amplitude = 0.5;
sw.Frequency = 100e3;
sw.ComplexOutput = true;
sw.SampleRate = tx.BasebandSampleRate;
sw.SamplesPerFrame = 1000;
txWaveform = sw();
%%发送信号
transmitRepeat(tx,txWaveform)
release(tx);
the error is
包含以下字段的 struct:
Status: ‘Unable to setup device’
MsgDetails: ‘Channel: altvoltage4 not found.’
11 tx.CenterFrequency = 2.415e9;
## Establishing connection to hardware. This process can take several seconds.
错误使用 matlabshared.libiio.base/cstatusid
Channel: altvoltage4 not found.
出错 matlabshared.libiio.base/getChan
出错 comm.libiio.AD9361.tx_control/setupDDSChannel
出错 comm.libiio.AD9361.tx_control/SetupDDS
出错 comm.libiio.AD9361.tx_control/sdrDevPreInit
出错 comm.libiio.AD9361.tx/sdrDevPreInit
出错 comm.zynqradioshared.tx/sdrDevPreInit
出错 comm.libiio.AD9361.base_control/configureChanBuffers
出错 comm.libiio.AD9361.base/configureChanBuffers
出错 matlabshared.libiio.base/setupImpl
出错 comm.libiio.AD9361.base_control/setupImpl
出错 comm.libiio.AD9361.base/setupImpl
出错 comm.libiio.AD9361.tx_control/setupImpl
出错 comm.libiio.AD9361.tx/setupImpl
出错 comm.zynqradioshared.tx/setupImpl
出错 comm.libiio.AD9361.tx/transmitRepeat
出错 Untitled (第 28 行)
transmitRepeat(tx,txWaveform)
but I think the firmware is ok because I test it on GNU Radio and ADI IIO Osi they both work.
when I swith the sdrtx(‘AD936x’ to sdrtx(‘pluto’,I get the error
The radio with ID usb:0 is already owned by a block, hello I am tring to use matlab with ad9363+ zynq ,the firmware is plutosdr v0.38 built by myself,the iio version is v0.25
the matlab code is
warning(‘off’,’plutoradio:sysobj:FirmwareIncompatible’);
%%ad9361配置
tx = sdrtx(‘AD936x’,…
‘IPAddress’,’192.168.5.23′,…
‘ChannelMapping’,1)
radioSettings = info(tx)
tx.CenterFrequency = 2.415e9;
tx.BasebandSampleRate = 2e6;
tx.Gain = -5;
%% 信号波形设置
sw = dsp.SineWave;
sw.Amplitude = 0.5;
sw.Frequency = 100e3;
sw.ComplexOutput = true;
sw.SampleRate = tx.BasebandSampleRate;
sw.SamplesPerFrame = 1000;
txWaveform = sw();
%%发送信号
transmitRepeat(tx,txWaveform)
release(tx);
the error is
包含以下字段的 struct:
Status: ‘Unable to setup device’
MsgDetails: ‘Channel: altvoltage4 not found.’
11 tx.CenterFrequency = 2.415e9;
## Establishing connection to hardware. This process can take several seconds.
错误使用 matlabshared.libiio.base/cstatusid
Channel: altvoltage4 not found.
出错 matlabshared.libiio.base/getChan
出错 comm.libiio.AD9361.tx_control/setupDDSChannel
出错 comm.libiio.AD9361.tx_control/SetupDDS
出错 comm.libiio.AD9361.tx_control/sdrDevPreInit
出错 comm.libiio.AD9361.tx/sdrDevPreInit
出错 comm.zynqradioshared.tx/sdrDevPreInit
出错 comm.libiio.AD9361.base_control/configureChanBuffers
出错 comm.libiio.AD9361.base/configureChanBuffers
出错 matlabshared.libiio.base/setupImpl
出错 comm.libiio.AD9361.base_control/setupImpl
出错 comm.libiio.AD9361.base/setupImpl
出错 comm.libiio.AD9361.tx_control/setupImpl
出错 comm.libiio.AD9361.tx/setupImpl
出错 comm.zynqradioshared.tx/setupImpl
出错 comm.libiio.AD9361.tx/transmitRepeat
出错 Untitled (第 28 行)
transmitRepeat(tx,txWaveform)
but I think the firmware is ok because I test it on GNU Radio and ADI IIO Osi they both work.
when I swith the sdrtx(‘AD936x’ to sdrtx(‘pluto’,I get the error
The radio with ID usb:0 is already owned by a block, ad936x MATLAB Answers — New Questions
state of charge balancing control
is it possible to control state of charge with PID?is it possible to control state of charge with PID? is it possible to control state of charge with PID? mmc, state of charge balancing control, pid MATLAB Answers — New Questions
Performance of MATLAB with MacBook with M1 or M2 chips
is there any benchmarking done for Matlab operating on new Macbooks with M1 or M2 chips ?is there any benchmarking done for Matlab operating on new Macbooks with M1 or M2 chips ? is there any benchmarking done for Matlab operating on new Macbooks with M1 or M2 chips ? macbookm1chip MATLAB Answers — New Questions
Why don’t my matlab drive files appear in matlab online?
I have uploaded simulin files to my matlab drive, but the matlab files section does not appear, nor do they appear when I search for them manually in the open section, despite already being uploaded to the driveI have uploaded simulin files to my matlab drive, but the matlab files section does not appear, nor do they appear when I search for them manually in the open section, despite already being uploaded to the drive I have uploaded simulin files to my matlab drive, but the matlab files section does not appear, nor do they appear when I search for them manually in the open section, despite already being uploaded to the drive matlab, simulink, file MATLAB Answers — New Questions
How can I implement Dual LSTM in matlab?
I want to implement dual LSTM network in matlab. How can i do it ? When I run this code, i get error as :
"Network: Invalid input layers. Network must have at most one sequence input layer".
How can i solve it? I would be grateful for your quick solution.
My objective is to train different types of features with seperate LSTM models and concatenate the outputs for fully connected layer to get single classification output.
Is it possible in matlab ?
inputSize1 = 4;
inputSize2 = 20;
numClasses = 5;
layers1 = [ …
sequenceInputLayer(inputSize1, ‘Name’, ‘input1’)
lstmLayer(64, ‘OutputMode’, ‘last’, ‘Name’, ‘lstm1’)
dropoutLayer(0.2, ‘Name’, ‘dropout1’)
fullyConnectedLayer(64, ‘Name’, ‘fc1’)];
layers2 = [ …
sequenceInputLayer(inputSize2, ‘Name’, ‘input2’)
lstmLayer(64, ‘OutputMode’, ‘last’, ‘Name’, ‘lstm2’)
dropoutLayer(0.2, ‘Name’, ‘dropout2’)
fullyConnectedLayer(64, ‘Name’, ‘fc2’)];
combinedLayers = [ …
concatenationLayer(1, 2, ‘Name’, ‘concat’)
fullyConnectedLayer(64, ‘Name’, ‘fc_combined’)
reluLayer(‘Name’, ‘relu’)
fullyConnectedLayer(numClasses, ‘Name’, ‘fc_final’)
softmaxLayer(‘Name’, ‘softmax’)
classificationLayer(‘Name’, ‘classification’)];
lgraph = layerGraph();
lgraph = addLayers(lgraph, layers1);
lgraph = addLayers(lgraph, layers2);
lgraph = addLayers(lgraph, combinedLayers);
lgraph = connectLayers(lgraph, ‘fc1’, ‘concat/in1’);
lgraph = connectLayers(lgraph, ‘fc2’, ‘concat/in2’);
plot(lgraph);
options = trainingOptions(‘adam’, …
‘InitialLearnRate’, 0.001, …
‘MaxEpochs’, 10, …
‘MiniBatchSize’, 32, …
‘Shuffle’, ‘once’, …
‘Plots’, ‘training-progress’, …
‘Verbose’, false);
net = trainNetwork(Normalized_data, y_train, lgraph, options);I want to implement dual LSTM network in matlab. How can i do it ? When I run this code, i get error as :
"Network: Invalid input layers. Network must have at most one sequence input layer".
How can i solve it? I would be grateful for your quick solution.
My objective is to train different types of features with seperate LSTM models and concatenate the outputs for fully connected layer to get single classification output.
Is it possible in matlab ?
inputSize1 = 4;
inputSize2 = 20;
numClasses = 5;
layers1 = [ …
sequenceInputLayer(inputSize1, ‘Name’, ‘input1’)
lstmLayer(64, ‘OutputMode’, ‘last’, ‘Name’, ‘lstm1’)
dropoutLayer(0.2, ‘Name’, ‘dropout1’)
fullyConnectedLayer(64, ‘Name’, ‘fc1’)];
layers2 = [ …
sequenceInputLayer(inputSize2, ‘Name’, ‘input2’)
lstmLayer(64, ‘OutputMode’, ‘last’, ‘Name’, ‘lstm2’)
dropoutLayer(0.2, ‘Name’, ‘dropout2’)
fullyConnectedLayer(64, ‘Name’, ‘fc2’)];
combinedLayers = [ …
concatenationLayer(1, 2, ‘Name’, ‘concat’)
fullyConnectedLayer(64, ‘Name’, ‘fc_combined’)
reluLayer(‘Name’, ‘relu’)
fullyConnectedLayer(numClasses, ‘Name’, ‘fc_final’)
softmaxLayer(‘Name’, ‘softmax’)
classificationLayer(‘Name’, ‘classification’)];
lgraph = layerGraph();
lgraph = addLayers(lgraph, layers1);
lgraph = addLayers(lgraph, layers2);
lgraph = addLayers(lgraph, combinedLayers);
lgraph = connectLayers(lgraph, ‘fc1’, ‘concat/in1’);
lgraph = connectLayers(lgraph, ‘fc2’, ‘concat/in2’);
plot(lgraph);
options = trainingOptions(‘adam’, …
‘InitialLearnRate’, 0.001, …
‘MaxEpochs’, 10, …
‘MiniBatchSize’, 32, …
‘Shuffle’, ‘once’, …
‘Plots’, ‘training-progress’, …
‘Verbose’, false);
net = trainNetwork(Normalized_data, y_train, lgraph, options); I want to implement dual LSTM network in matlab. How can i do it ? When I run this code, i get error as :
"Network: Invalid input layers. Network must have at most one sequence input layer".
How can i solve it? I would be grateful for your quick solution.
My objective is to train different types of features with seperate LSTM models and concatenate the outputs for fully connected layer to get single classification output.
Is it possible in matlab ?
inputSize1 = 4;
inputSize2 = 20;
numClasses = 5;
layers1 = [ …
sequenceInputLayer(inputSize1, ‘Name’, ‘input1’)
lstmLayer(64, ‘OutputMode’, ‘last’, ‘Name’, ‘lstm1’)
dropoutLayer(0.2, ‘Name’, ‘dropout1’)
fullyConnectedLayer(64, ‘Name’, ‘fc1’)];
layers2 = [ …
sequenceInputLayer(inputSize2, ‘Name’, ‘input2’)
lstmLayer(64, ‘OutputMode’, ‘last’, ‘Name’, ‘lstm2’)
dropoutLayer(0.2, ‘Name’, ‘dropout2’)
fullyConnectedLayer(64, ‘Name’, ‘fc2’)];
combinedLayers = [ …
concatenationLayer(1, 2, ‘Name’, ‘concat’)
fullyConnectedLayer(64, ‘Name’, ‘fc_combined’)
reluLayer(‘Name’, ‘relu’)
fullyConnectedLayer(numClasses, ‘Name’, ‘fc_final’)
softmaxLayer(‘Name’, ‘softmax’)
classificationLayer(‘Name’, ‘classification’)];
lgraph = layerGraph();
lgraph = addLayers(lgraph, layers1);
lgraph = addLayers(lgraph, layers2);
lgraph = addLayers(lgraph, combinedLayers);
lgraph = connectLayers(lgraph, ‘fc1’, ‘concat/in1’);
lgraph = connectLayers(lgraph, ‘fc2’, ‘concat/in2’);
plot(lgraph);
options = trainingOptions(‘adam’, …
‘InitialLearnRate’, 0.001, …
‘MaxEpochs’, 10, …
‘MiniBatchSize’, 32, …
‘Shuffle’, ‘once’, …
‘Plots’, ‘training-progress’, …
‘Verbose’, false);
net = trainNetwork(Normalized_data, y_train, lgraph, options); lstm, dual, concatenation of layers MATLAB Answers — New Questions