Tag Archives: matlab
How to modify the response of a antenna element with respect to different opearting frequency in the specified frequency range?
Take the phased.IsotropoicAntennaElement as an example. ‘FrequencyRange’ is set between 1GHz and 2GHz. Under the default cofiguration, the response of the antenna in the specified ‘FrequencyRange’ is a constant of one. I wonder how can I change the respose with respect to different frequency.
antenna = phased.IsotropicAntennaElement(‘FrequencyRange’,[1e9 2e9]);
fc = 1e9*(1:0.1:2);
resp = antenna(fc,[0;0])Take the phased.IsotropoicAntennaElement as an example. ‘FrequencyRange’ is set between 1GHz and 2GHz. Under the default cofiguration, the response of the antenna in the specified ‘FrequencyRange’ is a constant of one. I wonder how can I change the respose with respect to different frequency.
antenna = phased.IsotropicAntennaElement(‘FrequencyRange’,[1e9 2e9]);
fc = 1e9*(1:0.1:2);
resp = antenna(fc,[0;0]) Take the phased.IsotropoicAntennaElement as an example. ‘FrequencyRange’ is set between 1GHz and 2GHz. Under the default cofiguration, the response of the antenna in the specified ‘FrequencyRange’ is a constant of one. I wonder how can I change the respose with respect to different frequency.
antenna = phased.IsotropicAntennaElement(‘FrequencyRange’,[1e9 2e9]);
fc = 1e9*(1:0.1:2);
resp = antenna(fc,[0;0]) antenna response MATLAB Answers — New Questions
phased array antenna simulation
i want to simualte antenna radition pattern of radar rx antenna using 8 element linear antenna (as shown in figure 2).i could able to create the required radiation pattern by placing the antenna element on Y axis(ref figure 1) ,(Matlab code is attached for reference):
%%%%%%%%%START of matlab code for antenna element placing on Y axis %%%%%%%%%%%%%
clc;
clear all;
close all;
%fc = 77e9;
fc = 60e9;
%c = 3e8;
c = physconst(‘LightSpeed’);
lambda = c/fc;
Nt = 2;
Nr = 4;
ang = -90:90;
% % If both arrays have half-wavelength spacing, which are sometimes referred to as full arrays,
% % then the two-way pattern is close to the receive array pattern.
dr = lambda/2;
dt = Nr*(lambda/2);
Vy_pos1 = [0;-lambda;0];
Vy_pos2 = [0;-lambda+(lambda/2);0];
Vy_pos3 = [0;-lambda+ 2*(lambda/2);0];
Vy_pos4 = [0;-lambda+ 3*(lambda/2);0];
Vy_pos5 = [0;-lambda+ 4*(lambda/2);0];
Vy_pos6 = [0;-lambda+ 5*(lambda/2);0];
Vy_pos7 = [0;-lambda+ 6*(lambda/2);0];
Vy_pos8 = [0;-lambda+ 7*(lambda/2);0];
vxarray_4 = phased.ConformalArray(‘ElementPosition’,[Vy_pos1,Vy_pos2,Vy_pos3,Vy_pos4,Vy_pos5,Vy_pos6,Vy_pos7,Vy_pos8]);
figure
viewArray(vxarray_4 ,’ShowIndex’,’All’,’ShowNormal’,true,’Title’,’ conformal virtual array ,aantenna elements placed on Y axis’);
patv_4 = pattern(vxarray_4,fc,ang,0,’Type’,’powerdb’);
figure;
helperPlotMultipledBPattern(ang,[patv_4],[-30 0],…
{‘Two-way Pattern’,’Virtual Array Pattern’},…
‘Patterns of thin/full arrays and virtual array’,…
{‘-‘,’–‘},[1 2]);
%%%%%%%%%End of matlab code for antenna element placing on Y axis %%%%%%%%%%%%%
But my requirement is to achieve the same radaiation pattern by keeping antenna elements placement on X axis insetad of Y axis.please kindly check and confirm on how to realise same pattern by placing antenna element on the X axis(instead of y axis)?
i tried to place antenna elements on X axis and try to plot the resultant pattern but it doesnot meet the my required pattern.
figures and codes of the same are attached for reference.
%%%%%%%%%START of matlab code for antenna element placing on X axis %%%%%%%%%%%%%
clc;
clear all;
close all;
%fc = 77e9;
fc = 60e9;
%c = 3e8;
c = physconst(‘LightSpeed’);
lambda = c/fc;
Nt = 2;
Nr = 4;
ang = -90:90;
% % If both arrays have half-wavelength spacing, which are sometimes referred to as full arrays,
% % then the two-way pattern is close to the receive array pattern.
dr = lambda/2;
dt = Nr*(lambda/2);
Vx_pos1 = [-lambda;0;0];
Vx_pos2 = [-lambda+(lambda/2);0;0];
Vx_pos3 = [-lambda+ 2*(lambda/2);0;0];
Vx_pos4 = [-lambda+ 3*(lambda/2);0;0];
Vx_pos5 = [-lambda+ 4*(lambda/2);0;0];
Vx_pos6 = [-lambda+ 5*(lambda/2);0;0];
Vx_pos7 = [-lambda+ 6*(lambda/2);0;0];
Vx_pos8 = [-lambda+ 7*(lambda/2);0;0];
vxarray_3 = phased.ConformalArray(‘ElementPosition’,[Vx_pos1,Vx_pos2,Vx_pos3,Vx_pos4,Vx_pos5,Vx_pos6,Vx_pos7,Vx_pos8]);
figure
viewArray(vxarray_3 ,’ShowIndex’,’All’,’ShowNormal’,true,’Title’,’ conformal virtual array ,antenna elements placed on X axis’);
patv_3 = pattern(vxarray_3,fc,ang,0,’Type’,’powerdb’);
figure;
helperPlotMultipledBPattern(ang,[patv_3],[-30 0],…
{‘Two-way Pattern’,’Virtual Array Pattern’},…
‘Patterns of thin/full arrays and virtual array’,…
{‘-‘,’–‘},[1 2]);
%%%%%%%%%End of matlab code for antenna element placing on X axis %%%%%%%%%%%%%
please kindly check and confirm on how to realise rquired pattern by placing antenna element on the X axis(instead of y axis)?i want to simualte antenna radition pattern of radar rx antenna using 8 element linear antenna (as shown in figure 2).i could able to create the required radiation pattern by placing the antenna element on Y axis(ref figure 1) ,(Matlab code is attached for reference):
%%%%%%%%%START of matlab code for antenna element placing on Y axis %%%%%%%%%%%%%
clc;
clear all;
close all;
%fc = 77e9;
fc = 60e9;
%c = 3e8;
c = physconst(‘LightSpeed’);
lambda = c/fc;
Nt = 2;
Nr = 4;
ang = -90:90;
% % If both arrays have half-wavelength spacing, which are sometimes referred to as full arrays,
% % then the two-way pattern is close to the receive array pattern.
dr = lambda/2;
dt = Nr*(lambda/2);
Vy_pos1 = [0;-lambda;0];
Vy_pos2 = [0;-lambda+(lambda/2);0];
Vy_pos3 = [0;-lambda+ 2*(lambda/2);0];
Vy_pos4 = [0;-lambda+ 3*(lambda/2);0];
Vy_pos5 = [0;-lambda+ 4*(lambda/2);0];
Vy_pos6 = [0;-lambda+ 5*(lambda/2);0];
Vy_pos7 = [0;-lambda+ 6*(lambda/2);0];
Vy_pos8 = [0;-lambda+ 7*(lambda/2);0];
vxarray_4 = phased.ConformalArray(‘ElementPosition’,[Vy_pos1,Vy_pos2,Vy_pos3,Vy_pos4,Vy_pos5,Vy_pos6,Vy_pos7,Vy_pos8]);
figure
viewArray(vxarray_4 ,’ShowIndex’,’All’,’ShowNormal’,true,’Title’,’ conformal virtual array ,aantenna elements placed on Y axis’);
patv_4 = pattern(vxarray_4,fc,ang,0,’Type’,’powerdb’);
figure;
helperPlotMultipledBPattern(ang,[patv_4],[-30 0],…
{‘Two-way Pattern’,’Virtual Array Pattern’},…
‘Patterns of thin/full arrays and virtual array’,…
{‘-‘,’–‘},[1 2]);
%%%%%%%%%End of matlab code for antenna element placing on Y axis %%%%%%%%%%%%%
But my requirement is to achieve the same radaiation pattern by keeping antenna elements placement on X axis insetad of Y axis.please kindly check and confirm on how to realise same pattern by placing antenna element on the X axis(instead of y axis)?
i tried to place antenna elements on X axis and try to plot the resultant pattern but it doesnot meet the my required pattern.
figures and codes of the same are attached for reference.
%%%%%%%%%START of matlab code for antenna element placing on X axis %%%%%%%%%%%%%
clc;
clear all;
close all;
%fc = 77e9;
fc = 60e9;
%c = 3e8;
c = physconst(‘LightSpeed’);
lambda = c/fc;
Nt = 2;
Nr = 4;
ang = -90:90;
% % If both arrays have half-wavelength spacing, which are sometimes referred to as full arrays,
% % then the two-way pattern is close to the receive array pattern.
dr = lambda/2;
dt = Nr*(lambda/2);
Vx_pos1 = [-lambda;0;0];
Vx_pos2 = [-lambda+(lambda/2);0;0];
Vx_pos3 = [-lambda+ 2*(lambda/2);0;0];
Vx_pos4 = [-lambda+ 3*(lambda/2);0;0];
Vx_pos5 = [-lambda+ 4*(lambda/2);0;0];
Vx_pos6 = [-lambda+ 5*(lambda/2);0;0];
Vx_pos7 = [-lambda+ 6*(lambda/2);0;0];
Vx_pos8 = [-lambda+ 7*(lambda/2);0;0];
vxarray_3 = phased.ConformalArray(‘ElementPosition’,[Vx_pos1,Vx_pos2,Vx_pos3,Vx_pos4,Vx_pos5,Vx_pos6,Vx_pos7,Vx_pos8]);
figure
viewArray(vxarray_3 ,’ShowIndex’,’All’,’ShowNormal’,true,’Title’,’ conformal virtual array ,antenna elements placed on X axis’);
patv_3 = pattern(vxarray_3,fc,ang,0,’Type’,’powerdb’);
figure;
helperPlotMultipledBPattern(ang,[patv_3],[-30 0],…
{‘Two-way Pattern’,’Virtual Array Pattern’},…
‘Patterns of thin/full arrays and virtual array’,…
{‘-‘,’–‘},[1 2]);
%%%%%%%%%End of matlab code for antenna element placing on X axis %%%%%%%%%%%%%
please kindly check and confirm on how to realise rquired pattern by placing antenna element on the X axis(instead of y axis)? i want to simualte antenna radition pattern of radar rx antenna using 8 element linear antenna (as shown in figure 2).i could able to create the required radiation pattern by placing the antenna element on Y axis(ref figure 1) ,(Matlab code is attached for reference):
%%%%%%%%%START of matlab code for antenna element placing on Y axis %%%%%%%%%%%%%
clc;
clear all;
close all;
%fc = 77e9;
fc = 60e9;
%c = 3e8;
c = physconst(‘LightSpeed’);
lambda = c/fc;
Nt = 2;
Nr = 4;
ang = -90:90;
% % If both arrays have half-wavelength spacing, which are sometimes referred to as full arrays,
% % then the two-way pattern is close to the receive array pattern.
dr = lambda/2;
dt = Nr*(lambda/2);
Vy_pos1 = [0;-lambda;0];
Vy_pos2 = [0;-lambda+(lambda/2);0];
Vy_pos3 = [0;-lambda+ 2*(lambda/2);0];
Vy_pos4 = [0;-lambda+ 3*(lambda/2);0];
Vy_pos5 = [0;-lambda+ 4*(lambda/2);0];
Vy_pos6 = [0;-lambda+ 5*(lambda/2);0];
Vy_pos7 = [0;-lambda+ 6*(lambda/2);0];
Vy_pos8 = [0;-lambda+ 7*(lambda/2);0];
vxarray_4 = phased.ConformalArray(‘ElementPosition’,[Vy_pos1,Vy_pos2,Vy_pos3,Vy_pos4,Vy_pos5,Vy_pos6,Vy_pos7,Vy_pos8]);
figure
viewArray(vxarray_4 ,’ShowIndex’,’All’,’ShowNormal’,true,’Title’,’ conformal virtual array ,aantenna elements placed on Y axis’);
patv_4 = pattern(vxarray_4,fc,ang,0,’Type’,’powerdb’);
figure;
helperPlotMultipledBPattern(ang,[patv_4],[-30 0],…
{‘Two-way Pattern’,’Virtual Array Pattern’},…
‘Patterns of thin/full arrays and virtual array’,…
{‘-‘,’–‘},[1 2]);
%%%%%%%%%End of matlab code for antenna element placing on Y axis %%%%%%%%%%%%%
But my requirement is to achieve the same radaiation pattern by keeping antenna elements placement on X axis insetad of Y axis.please kindly check and confirm on how to realise same pattern by placing antenna element on the X axis(instead of y axis)?
i tried to place antenna elements on X axis and try to plot the resultant pattern but it doesnot meet the my required pattern.
figures and codes of the same are attached for reference.
%%%%%%%%%START of matlab code for antenna element placing on X axis %%%%%%%%%%%%%
clc;
clear all;
close all;
%fc = 77e9;
fc = 60e9;
%c = 3e8;
c = physconst(‘LightSpeed’);
lambda = c/fc;
Nt = 2;
Nr = 4;
ang = -90:90;
% % If both arrays have half-wavelength spacing, which are sometimes referred to as full arrays,
% % then the two-way pattern is close to the receive array pattern.
dr = lambda/2;
dt = Nr*(lambda/2);
Vx_pos1 = [-lambda;0;0];
Vx_pos2 = [-lambda+(lambda/2);0;0];
Vx_pos3 = [-lambda+ 2*(lambda/2);0;0];
Vx_pos4 = [-lambda+ 3*(lambda/2);0;0];
Vx_pos5 = [-lambda+ 4*(lambda/2);0;0];
Vx_pos6 = [-lambda+ 5*(lambda/2);0;0];
Vx_pos7 = [-lambda+ 6*(lambda/2);0;0];
Vx_pos8 = [-lambda+ 7*(lambda/2);0;0];
vxarray_3 = phased.ConformalArray(‘ElementPosition’,[Vx_pos1,Vx_pos2,Vx_pos3,Vx_pos4,Vx_pos5,Vx_pos6,Vx_pos7,Vx_pos8]);
figure
viewArray(vxarray_3 ,’ShowIndex’,’All’,’ShowNormal’,true,’Title’,’ conformal virtual array ,antenna elements placed on X axis’);
patv_3 = pattern(vxarray_3,fc,ang,0,’Type’,’powerdb’);
figure;
helperPlotMultipledBPattern(ang,[patv_3],[-30 0],…
{‘Two-way Pattern’,’Virtual Array Pattern’},…
‘Patterns of thin/full arrays and virtual array’,…
{‘-‘,’–‘},[1 2]);
%%%%%%%%%End of matlab code for antenna element placing on X axis %%%%%%%%%%%%%
please kindly check and confirm on how to realise rquired pattern by placing antenna element on the X axis(instead of y axis)? phased array antenna simulation MATLAB Answers — New Questions
Why cannot handle class events run indefinitely?
Suppose there are two objects A and B instantiated from some handle classes.
There is an event in A that B listens to, and an event in B that A listens to.
When the event in A is triggered, B trigger its own event, which in turn triggers the event in A, as demonstrated in the figure.
Theoretically, once the event in A is triggered the program should run indefinitely. However in practice the program terminates when the event in A has been triggered twice. Why?
Take following code snippets for example.
The class definition
classdef myClass < handle
properties
Name
end
events
theEvent
end
methods
function obj = myClass(c)
obj.Name = c;
end
function showName(obj)
disp([‘This is obj ‘, obj.Name])
notify(obj, ‘theEvent’)
end
end
end
The main file to run
A = myClass(‘A’);
B = myClass(‘B’);
addlistener(A, ‘theEvent’, @(varargin)B.showName());
addlistener(B, ‘theEvent’, @(varargin)A.showName());
disp(‘Program started’)
showName(A)
disp(‘Program terminated’)Suppose there are two objects A and B instantiated from some handle classes.
There is an event in A that B listens to, and an event in B that A listens to.
When the event in A is triggered, B trigger its own event, which in turn triggers the event in A, as demonstrated in the figure.
Theoretically, once the event in A is triggered the program should run indefinitely. However in practice the program terminates when the event in A has been triggered twice. Why?
Take following code snippets for example.
The class definition
classdef myClass < handle
properties
Name
end
events
theEvent
end
methods
function obj = myClass(c)
obj.Name = c;
end
function showName(obj)
disp([‘This is obj ‘, obj.Name])
notify(obj, ‘theEvent’)
end
end
end
The main file to run
A = myClass(‘A’);
B = myClass(‘B’);
addlistener(A, ‘theEvent’, @(varargin)B.showName());
addlistener(B, ‘theEvent’, @(varargin)A.showName());
disp(‘Program started’)
showName(A)
disp(‘Program terminated’) Suppose there are two objects A and B instantiated from some handle classes.
There is an event in A that B listens to, and an event in B that A listens to.
When the event in A is triggered, B trigger its own event, which in turn triggers the event in A, as demonstrated in the figure.
Theoretically, once the event in A is triggered the program should run indefinitely. However in practice the program terminates when the event in A has been triggered twice. Why?
Take following code snippets for example.
The class definition
classdef myClass < handle
properties
Name
end
events
theEvent
end
methods
function obj = myClass(c)
obj.Name = c;
end
function showName(obj)
disp([‘This is obj ‘, obj.Name])
notify(obj, ‘theEvent’)
end
end
end
The main file to run
A = myClass(‘A’);
B = myClass(‘B’);
addlistener(A, ‘theEvent’, @(varargin)B.showName());
addlistener(B, ‘theEvent’, @(varargin)A.showName());
disp(‘Program started’)
showName(A)
disp(‘Program terminated’) handle class events, infinite loop, oop MATLAB Answers — New Questions
Channel assignment and carrier aggregation for wifi 6(802.11ax) BER and SNR
I’m trying to make simulations for wifi 6 with channel assignment and carrier aggregation and i need to get BER and SNR values for my simulations i need help. Can you help me to make it and give me some ideas.I’m trying to make simulations for wifi 6 with channel assignment and carrier aggregation and i need to get BER and SNR values for my simulations i need help. Can you help me to make it and give me some ideas. I’m trying to make simulations for wifi 6 with channel assignment and carrier aggregation and i need to get BER and SNR values for my simulations i need help. Can you help me to make it and give me some ideas. 802.11ax, communication, wifi 6, wifi6, channel assignment, carrier aggregation MATLAB Answers — New Questions
How to set lower bound lb as a function of optimization variable.
I am solving one optimization using fmincon. Objectives function is a variable of x1,x2,x3.
B= 0; c =[ 0 0.1736 0.0693; 0 0 0.1736]
l_op = 6.3247;
rho = 1.225;
R=37.5; A = pi * R^2;
Z = 8;
n =3;
k= 0.1;
Th = sym(‘Th’, [1, n]);
x = sym(‘x’, [1, n]);
Lam = sym(‘Lam’, [1, n]);
Pt = sym(‘P_opt’, [1, n]);
Per = sym(‘Per’, [1, n]);
z = sym(‘z’, [1, n]);
z(1) = Z;
for i = 1:n
if i > 1
term_sum = 0;
for j = 1:i-1
term_sum = term_sum + ((1 – sqrt(1 – Th(j))) * c(j, i))^2;
end
z(i) = Z * (1 – sqrt(term_sum));
end
Lam(i) = (x(i) * R) / z(i);
Th(i) = (0.000086 * B – 0.0026) * Lam(i)^3 + (-0.0018 * B + 0.0481) * Lam(i)^2 + (0.008 * B – 0.165) * Lam(i) + (-0.0116 * B + 0.3);
Per(i) = 0.22 * (116 / (Lam(i) + 0.08 * B) – 4.06 / (B^3 + 1) – 0.4 * B – 5) * exp(-12.5 / (Lam(i) + 0.08 * B) + 0.4375 / (B^3 + 1));
Pt(i) = 0.5 * rho * A * Per(i) * z(i)^3;
end
objective = -sum(Pt)
Obj = matlabFunction(objective, ‘Vars’, {x});
% Lower and upper bounds
lb = 0.1687 * z(i) % z(i) is a function of x(i) *corrected
ub = 1.6867*ones(1,n);
% Initial guess
x0 = ones(1,n);
% Constraints
Aeq = [];
beq = [];
% Optimization using fmincon
options = optimoptions(‘fmincon’, ‘Display’, ‘iter’, ‘Algorithm’, ‘interior-point’);
% % Optimize the objective function
[x_opt, fval_opt] = fmincon(Obj, x0, [], [], Aeq, beq, lb, ub, [], options);
In my optimization lower bound of the optimization is a function of optimaztion variables. How can I solve it? fmincon can be able to do it or another optimization tools can be chosen?I am solving one optimization using fmincon. Objectives function is a variable of x1,x2,x3.
B= 0; c =[ 0 0.1736 0.0693; 0 0 0.1736]
l_op = 6.3247;
rho = 1.225;
R=37.5; A = pi * R^2;
Z = 8;
n =3;
k= 0.1;
Th = sym(‘Th’, [1, n]);
x = sym(‘x’, [1, n]);
Lam = sym(‘Lam’, [1, n]);
Pt = sym(‘P_opt’, [1, n]);
Per = sym(‘Per’, [1, n]);
z = sym(‘z’, [1, n]);
z(1) = Z;
for i = 1:n
if i > 1
term_sum = 0;
for j = 1:i-1
term_sum = term_sum + ((1 – sqrt(1 – Th(j))) * c(j, i))^2;
end
z(i) = Z * (1 – sqrt(term_sum));
end
Lam(i) = (x(i) * R) / z(i);
Th(i) = (0.000086 * B – 0.0026) * Lam(i)^3 + (-0.0018 * B + 0.0481) * Lam(i)^2 + (0.008 * B – 0.165) * Lam(i) + (-0.0116 * B + 0.3);
Per(i) = 0.22 * (116 / (Lam(i) + 0.08 * B) – 4.06 / (B^3 + 1) – 0.4 * B – 5) * exp(-12.5 / (Lam(i) + 0.08 * B) + 0.4375 / (B^3 + 1));
Pt(i) = 0.5 * rho * A * Per(i) * z(i)^3;
end
objective = -sum(Pt)
Obj = matlabFunction(objective, ‘Vars’, {x});
% Lower and upper bounds
lb = 0.1687 * z(i) % z(i) is a function of x(i) *corrected
ub = 1.6867*ones(1,n);
% Initial guess
x0 = ones(1,n);
% Constraints
Aeq = [];
beq = [];
% Optimization using fmincon
options = optimoptions(‘fmincon’, ‘Display’, ‘iter’, ‘Algorithm’, ‘interior-point’);
% % Optimize the objective function
[x_opt, fval_opt] = fmincon(Obj, x0, [], [], Aeq, beq, lb, ub, [], options);
In my optimization lower bound of the optimization is a function of optimaztion variables. How can I solve it? fmincon can be able to do it or another optimization tools can be chosen? I am solving one optimization using fmincon. Objectives function is a variable of x1,x2,x3.
B= 0; c =[ 0 0.1736 0.0693; 0 0 0.1736]
l_op = 6.3247;
rho = 1.225;
R=37.5; A = pi * R^2;
Z = 8;
n =3;
k= 0.1;
Th = sym(‘Th’, [1, n]);
x = sym(‘x’, [1, n]);
Lam = sym(‘Lam’, [1, n]);
Pt = sym(‘P_opt’, [1, n]);
Per = sym(‘Per’, [1, n]);
z = sym(‘z’, [1, n]);
z(1) = Z;
for i = 1:n
if i > 1
term_sum = 0;
for j = 1:i-1
term_sum = term_sum + ((1 – sqrt(1 – Th(j))) * c(j, i))^2;
end
z(i) = Z * (1 – sqrt(term_sum));
end
Lam(i) = (x(i) * R) / z(i);
Th(i) = (0.000086 * B – 0.0026) * Lam(i)^3 + (-0.0018 * B + 0.0481) * Lam(i)^2 + (0.008 * B – 0.165) * Lam(i) + (-0.0116 * B + 0.3);
Per(i) = 0.22 * (116 / (Lam(i) + 0.08 * B) – 4.06 / (B^3 + 1) – 0.4 * B – 5) * exp(-12.5 / (Lam(i) + 0.08 * B) + 0.4375 / (B^3 + 1));
Pt(i) = 0.5 * rho * A * Per(i) * z(i)^3;
end
objective = -sum(Pt)
Obj = matlabFunction(objective, ‘Vars’, {x});
% Lower and upper bounds
lb = 0.1687 * z(i) % z(i) is a function of x(i) *corrected
ub = 1.6867*ones(1,n);
% Initial guess
x0 = ones(1,n);
% Constraints
Aeq = [];
beq = [];
% Optimization using fmincon
options = optimoptions(‘fmincon’, ‘Display’, ‘iter’, ‘Algorithm’, ‘interior-point’);
% % Optimize the objective function
[x_opt, fval_opt] = fmincon(Obj, x0, [], [], Aeq, beq, lb, ub, [], options);
In my optimization lower bound of the optimization is a function of optimaztion variables. How can I solve it? fmincon can be able to do it or another optimization tools can be chosen? optimization, fmincon, lower bound MATLAB Answers — New Questions
My function doesn’t append to it’s list
%calculates polynomials of form Pk = ((2k-1)t/k)*Pk-1 – ((k-1)/k)*Pk-2
function [poly, filllist] = calc_poly (n, t, filllist)
if n == 0
filllist = [filllist; ones(size(t))];
poly = ones(size(t));
return
end
if n == 1
filllist = [filllist; t];
poly = t;
return
end
poly = ((2*n-1)/n)*t.*calc_poly(n-1, t, filllist) – ((n-1)/n)*calc_poly(n-2, t, filllist);
filllist = [filllist; poly];
end
This function is supposed to recursively calculate the polys and append them into filllist, but the array remians unalatered after running it. I know that as it stands there would be duplicates in the list, but I first want to get the function to actually do anything.%calculates polynomials of form Pk = ((2k-1)t/k)*Pk-1 – ((k-1)/k)*Pk-2
function [poly, filllist] = calc_poly (n, t, filllist)
if n == 0
filllist = [filllist; ones(size(t))];
poly = ones(size(t));
return
end
if n == 1
filllist = [filllist; t];
poly = t;
return
end
poly = ((2*n-1)/n)*t.*calc_poly(n-1, t, filllist) – ((n-1)/n)*calc_poly(n-2, t, filllist);
filllist = [filllist; poly];
end
This function is supposed to recursively calculate the polys and append them into filllist, but the array remians unalatered after running it. I know that as it stands there would be duplicates in the list, but I first want to get the function to actually do anything. %calculates polynomials of form Pk = ((2k-1)t/k)*Pk-1 – ((k-1)/k)*Pk-2
function [poly, filllist] = calc_poly (n, t, filllist)
if n == 0
filllist = [filllist; ones(size(t))];
poly = ones(size(t));
return
end
if n == 1
filllist = [filllist; t];
poly = t;
return
end
poly = ((2*n-1)/n)*t.*calc_poly(n-1, t, filllist) – ((n-1)/n)*calc_poly(n-2, t, filllist);
filllist = [filllist; poly];
end
This function is supposed to recursively calculate the polys and append them into filllist, but the array remians unalatered after running it. I know that as it stands there would be duplicates in the list, but I first want to get the function to actually do anything. matlab code, arrays, functions MATLAB Answers — New Questions
how to solve this problem?
When I run the code I get this error
clc;
% System parameters definition
m = 10;
A = [0 1; 0 0];
B = [0; 1/m];
C = [1 0; 0 1];
D = 0;
% State-space model creation
sys = ss(A, B, C, D);
% Number of experiments
N = 1000;
U = cell(N,1);
Y = cell(N,1);
rng(0);
%% Dataset generation for identification
for i = 1:N
% Generating random input sequence (force)
t = linspace(0, 1, 11)’;
u = 0.5 * randn(size(t));
% Random initial conditions for velocity and position
x0 = [0.5 * randn(1, 1); 0.5 * randn(1, 1)];
% System simulation
x = lsim(sys, u, t, x0);
% Saving input sequences and state measurements
U{i} = timetable(seconds(t), u);
Y{i} = timetable(seconds(t), x(:,1), x(:,2));
end
%% Generate Data Set for Validation
% Use random initial state and input sequence
t = linspace(0,10,101)’;
u = 0.5*randn(size(t));
x0 = [0.5*randn(1,1);0.5*randn(1,1)];
% Obtain state measurements over t
x = lsim(sys,u,t,x0);
% Append the validation experiment (also a timetable) as the last entry in the data set
U{end+1} = timetable(seconds(t), u);
Y{end+1} = timetable(seconds(t), x(:,1), x(:,2));
%% Creation and initialization of the state-space model
sys = idNeuralStateSpace(2, NumInputs=1); % Valid if nx=ny where nx is the number of states and ny is the number of outputs
sys.StateName = {‘Position’, ‘Velocity’}; % State variable names declaration
sys.InputName = ‘Force’; % Input name declaration (1 in this case)
sys.InputUnit = ‘N’;
sys.OutputName = {‘Position’, ‘Velocity’}; % Output names addition
sys.StateUnit = {‘m’, ‘m/s’};
sys.OutputUnit = sys.StateUnit;
sys.Notes = "Prediction Model using Neural Network";
%% Inner layers declaration for the state network
% State network
sys.StateNetwork = createMLPNetwork(sys, ‘state’, …
‘LayerSizes’, 128, …
‘Activations’, "tanh", …
‘WeightsInitializer’, "glorot", …
‘BiasInitializer’, "zeros");
%% Training options declaration for the state network
opt = nssTrainingOptions(‘adam’);
opt.MaxEpochs = 400;
opt.MiniBatchSize = N;
opt.LearnRate = 0.005;
%% Testing
resultTrain = nlssest(U, Y, sys, opt, ‘UseLastExperimentForValidation’, true);
where am I wrong?When I run the code I get this error
clc;
% System parameters definition
m = 10;
A = [0 1; 0 0];
B = [0; 1/m];
C = [1 0; 0 1];
D = 0;
% State-space model creation
sys = ss(A, B, C, D);
% Number of experiments
N = 1000;
U = cell(N,1);
Y = cell(N,1);
rng(0);
%% Dataset generation for identification
for i = 1:N
% Generating random input sequence (force)
t = linspace(0, 1, 11)’;
u = 0.5 * randn(size(t));
% Random initial conditions for velocity and position
x0 = [0.5 * randn(1, 1); 0.5 * randn(1, 1)];
% System simulation
x = lsim(sys, u, t, x0);
% Saving input sequences and state measurements
U{i} = timetable(seconds(t), u);
Y{i} = timetable(seconds(t), x(:,1), x(:,2));
end
%% Generate Data Set for Validation
% Use random initial state and input sequence
t = linspace(0,10,101)’;
u = 0.5*randn(size(t));
x0 = [0.5*randn(1,1);0.5*randn(1,1)];
% Obtain state measurements over t
x = lsim(sys,u,t,x0);
% Append the validation experiment (also a timetable) as the last entry in the data set
U{end+1} = timetable(seconds(t), u);
Y{end+1} = timetable(seconds(t), x(:,1), x(:,2));
%% Creation and initialization of the state-space model
sys = idNeuralStateSpace(2, NumInputs=1); % Valid if nx=ny where nx is the number of states and ny is the number of outputs
sys.StateName = {‘Position’, ‘Velocity’}; % State variable names declaration
sys.InputName = ‘Force’; % Input name declaration (1 in this case)
sys.InputUnit = ‘N’;
sys.OutputName = {‘Position’, ‘Velocity’}; % Output names addition
sys.StateUnit = {‘m’, ‘m/s’};
sys.OutputUnit = sys.StateUnit;
sys.Notes = "Prediction Model using Neural Network";
%% Inner layers declaration for the state network
% State network
sys.StateNetwork = createMLPNetwork(sys, ‘state’, …
‘LayerSizes’, 128, …
‘Activations’, "tanh", …
‘WeightsInitializer’, "glorot", …
‘BiasInitializer’, "zeros");
%% Training options declaration for the state network
opt = nssTrainingOptions(‘adam’);
opt.MaxEpochs = 400;
opt.MiniBatchSize = N;
opt.LearnRate = 0.005;
%% Testing
resultTrain = nlssest(U, Y, sys, opt, ‘UseLastExperimentForValidation’, true);
where am I wrong? When I run the code I get this error
clc;
% System parameters definition
m = 10;
A = [0 1; 0 0];
B = [0; 1/m];
C = [1 0; 0 1];
D = 0;
% State-space model creation
sys = ss(A, B, C, D);
% Number of experiments
N = 1000;
U = cell(N,1);
Y = cell(N,1);
rng(0);
%% Dataset generation for identification
for i = 1:N
% Generating random input sequence (force)
t = linspace(0, 1, 11)’;
u = 0.5 * randn(size(t));
% Random initial conditions for velocity and position
x0 = [0.5 * randn(1, 1); 0.5 * randn(1, 1)];
% System simulation
x = lsim(sys, u, t, x0);
% Saving input sequences and state measurements
U{i} = timetable(seconds(t), u);
Y{i} = timetable(seconds(t), x(:,1), x(:,2));
end
%% Generate Data Set for Validation
% Use random initial state and input sequence
t = linspace(0,10,101)’;
u = 0.5*randn(size(t));
x0 = [0.5*randn(1,1);0.5*randn(1,1)];
% Obtain state measurements over t
x = lsim(sys,u,t,x0);
% Append the validation experiment (also a timetable) as the last entry in the data set
U{end+1} = timetable(seconds(t), u);
Y{end+1} = timetable(seconds(t), x(:,1), x(:,2));
%% Creation and initialization of the state-space model
sys = idNeuralStateSpace(2, NumInputs=1); % Valid if nx=ny where nx is the number of states and ny is the number of outputs
sys.StateName = {‘Position’, ‘Velocity’}; % State variable names declaration
sys.InputName = ‘Force’; % Input name declaration (1 in this case)
sys.InputUnit = ‘N’;
sys.OutputName = {‘Position’, ‘Velocity’}; % Output names addition
sys.StateUnit = {‘m’, ‘m/s’};
sys.OutputUnit = sys.StateUnit;
sys.Notes = "Prediction Model using Neural Network";
%% Inner layers declaration for the state network
% State network
sys.StateNetwork = createMLPNetwork(sys, ‘state’, …
‘LayerSizes’, 128, …
‘Activations’, "tanh", …
‘WeightsInitializer’, "glorot", …
‘BiasInitializer’, "zeros");
%% Training options declaration for the state network
opt = nssTrainingOptions(‘adam’);
opt.MaxEpochs = 400;
opt.MiniBatchSize = N;
opt.LearnRate = 0.005;
%% Testing
resultTrain = nlssest(U, Y, sys, opt, ‘UseLastExperimentForValidation’, true);
where am I wrong? nlssest, matlab code MATLAB Answers — New Questions
How can I display a line in 3D with a colour gradient?
Let’s say I have a set of 10 tridimensional points, represented as a 3 by 10 matrix, such as these points generated just for the sake of illustration:
n = 10;
x = linspace(1, 2, n);
y = cos(x);
z = y.^2;
points = [x’ y’ z’]
I can display them as a line in 3D:
plot3(points(:,1,:), points(:,2,:), points(:,3,:));
My question is: how can I apply a color gradient to this line, so we can see in what direction does the line evolve (relative to the order of the point in the points matrix)?
I tried several methods, without success so far:
Calling plot3 with the c parameter (as suggested by an answer on the Internet): the c keyword is not recognised.
Calling colormap with a custom made map: no graph is displayed at all, even though no error is thrown.
cmap = [linspace(0, 1, n)’ zeros(n, 1) zeros(n, 1)];
colormap(cmap);Let’s say I have a set of 10 tridimensional points, represented as a 3 by 10 matrix, such as these points generated just for the sake of illustration:
n = 10;
x = linspace(1, 2, n);
y = cos(x);
z = y.^2;
points = [x’ y’ z’]
I can display them as a line in 3D:
plot3(points(:,1,:), points(:,2,:), points(:,3,:));
My question is: how can I apply a color gradient to this line, so we can see in what direction does the line evolve (relative to the order of the point in the points matrix)?
I tried several methods, without success so far:
Calling plot3 with the c parameter (as suggested by an answer on the Internet): the c keyword is not recognised.
Calling colormap with a custom made map: no graph is displayed at all, even though no error is thrown.
cmap = [linspace(0, 1, n)’ zeros(n, 1) zeros(n, 1)];
colormap(cmap); Let’s say I have a set of 10 tridimensional points, represented as a 3 by 10 matrix, such as these points generated just for the sake of illustration:
n = 10;
x = linspace(1, 2, n);
y = cos(x);
z = y.^2;
points = [x’ y’ z’]
I can display them as a line in 3D:
plot3(points(:,1,:), points(:,2,:), points(:,3,:));
My question is: how can I apply a color gradient to this line, so we can see in what direction does the line evolve (relative to the order of the point in the points matrix)?
I tried several methods, without success so far:
Calling plot3 with the c parameter (as suggested by an answer on the Internet): the c keyword is not recognised.
Calling colormap with a custom made map: no graph is displayed at all, even though no error is thrown.
cmap = [linspace(0, 1, n)’ zeros(n, 1) zeros(n, 1)];
colormap(cmap); plot3, colormap MATLAB Answers — New Questions
App Designer – lamp display running status
I’m currently designing an app that takes input from the user, sends it to a Simulink block, and displays the result in graph form in the app. When you run the app, it takes about 10 seconds from when the "run" button is pressed until the simulation is complete and the results are displayed. I’d like to put a lamp next to the "run" button that changes color to red while the application is processing, and then turns back to green when the results are displayed. How can I do this?I’m currently designing an app that takes input from the user, sends it to a Simulink block, and displays the result in graph form in the app. When you run the app, it takes about 10 seconds from when the "run" button is pressed until the simulation is complete and the results are displayed. I’d like to put a lamp next to the "run" button that changes color to red while the application is processing, and then turns back to green when the results are displayed. How can I do this? I’m currently designing an app that takes input from the user, sends it to a Simulink block, and displays the result in graph form in the app. When you run the app, it takes about 10 seconds from when the "run" button is pressed until the simulation is complete and the results are displayed. I’d like to put a lamp next to the "run" button that changes color to red while the application is processing, and then turns back to green when the results are displayed. How can I do this? app designer, lamp MATLAB Answers — New Questions
Should the discrete 2D convolution from MATLAB be multiplied with twice the nodal step size ?
I am right now trying to verify the usage of "conv2" function in MATLAB to calculate two-dimensional convolution. My application area is not related to image processing or machine learning.
I set up a small test case where I have convolved two 2D Gaussian functions of different magnitudes. The convolution should be a Gaussian and it is what MATLAB generates.
I have discretized the nodal spacing with a value of "delta" in X and Y directions. Am I correct when I say that the final output of "conv2" should always be multiplied by "delta * delta" ? I am understanding this in terms of Riemann integral where the integration is calculated from first principles. Not sure if this is the correct way to think.
My test case’s results are matching with the symbolic result from MATHEMATICA but, after the output of "conv2" is multiplied by "delta*delta".I am right now trying to verify the usage of "conv2" function in MATLAB to calculate two-dimensional convolution. My application area is not related to image processing or machine learning.
I set up a small test case where I have convolved two 2D Gaussian functions of different magnitudes. The convolution should be a Gaussian and it is what MATLAB generates.
I have discretized the nodal spacing with a value of "delta" in X and Y directions. Am I correct when I say that the final output of "conv2" should always be multiplied by "delta * delta" ? I am understanding this in terms of Riemann integral where the integration is calculated from first principles. Not sure if this is the correct way to think.
My test case’s results are matching with the symbolic result from MATHEMATICA but, after the output of "conv2" is multiplied by "delta*delta". I am right now trying to verify the usage of "conv2" function in MATLAB to calculate two-dimensional convolution. My application area is not related to image processing or machine learning.
I set up a small test case where I have convolved two 2D Gaussian functions of different magnitudes. The convolution should be a Gaussian and it is what MATLAB generates.
I have discretized the nodal spacing with a value of "delta" in X and Y directions. Am I correct when I say that the final output of "conv2" should always be multiplied by "delta * delta" ? I am understanding this in terms of Riemann integral where the integration is calculated from first principles. Not sure if this is the correct way to think.
My test case’s results are matching with the symbolic result from MATHEMATICA but, after the output of "conv2" is multiplied by "delta*delta". convolution MATLAB Answers — New Questions
Curve fitting and parameter estimation with lsqcurvefit
Dear Matlab family…
I have been following previous chats about this topic but when I try to relate with my model I get the error below. Note that, to improve the accuacy of the model, not everything needs to be estimated from the dataset, some aspects like natural mortality can be obtained from literature and government records, so in this case, I want to pass mu and Lambda as I already obtained them from literature, and only estimate the other parameters. I have attached my matlab script and my data for your convinience. Thank you very much for your assistance. As this is experimental, feel free to vary the initial conditions and boundaries for the parameters.
Error using lsqcurvefit>initEvalErrorHandler
FUN must have two input arguments.
Error in lsqcurvefit (line 258)
userFcn_ME = initEvalErrorHandler(userFcn_ME,funfcn_x_xdata{3}, …
Error in fit_run (line 24)
estimated_params = lsqcurvefit(objective, initial_guess, lb, ub);Dear Matlab family…
I have been following previous chats about this topic but when I try to relate with my model I get the error below. Note that, to improve the accuacy of the model, not everything needs to be estimated from the dataset, some aspects like natural mortality can be obtained from literature and government records, so in this case, I want to pass mu and Lambda as I already obtained them from literature, and only estimate the other parameters. I have attached my matlab script and my data for your convinience. Thank you very much for your assistance. As this is experimental, feel free to vary the initial conditions and boundaries for the parameters.
Error using lsqcurvefit>initEvalErrorHandler
FUN must have two input arguments.
Error in lsqcurvefit (line 258)
userFcn_ME = initEvalErrorHandler(userFcn_ME,funfcn_x_xdata{3}, …
Error in fit_run (line 24)
estimated_params = lsqcurvefit(objective, initial_guess, lb, ub); Dear Matlab family…
I have been following previous chats about this topic but when I try to relate with my model I get the error below. Note that, to improve the accuacy of the model, not everything needs to be estimated from the dataset, some aspects like natural mortality can be obtained from literature and government records, so in this case, I want to pass mu and Lambda as I already obtained them from literature, and only estimate the other parameters. I have attached my matlab script and my data for your convinience. Thank you very much for your assistance. As this is experimental, feel free to vary the initial conditions and boundaries for the parameters.
Error using lsqcurvefit>initEvalErrorHandler
FUN must have two input arguments.
Error in lsqcurvefit (line 258)
userFcn_ME = initEvalErrorHandler(userFcn_ME,funfcn_x_xdata{3}, …
Error in fit_run (line 24)
estimated_params = lsqcurvefit(objective, initial_guess, lb, ub); curve fitting, parameter estimation MATLAB Answers — New Questions
Is there a way to add a Computer Label during automatic, online activation?
When activating manually through the License Center, I am able to add an Computer label to help track my activations. Is there any way to create this label when activating automatically?When activating manually through the License Center, I am able to add an Computer label to help track my activations. Is there any way to create this label when activating automatically? When activating manually through the License Center, I am able to add an Computer label to help track my activations. Is there any way to create this label when activating automatically? MATLAB Answers — New Questions
Why does the installer get stuck loading after signing in with my SSO credentials?
When trying to install MATLAB, I am able to successfully sign in with my SSO credentials, but afterwards the installer gets stuck with a loading symbol like the image below. I am never prompted to agree to the Software License Agreement. Why is the installer continuously loading forever when trying to sign in with SSO/Campus-Wide License?When trying to install MATLAB, I am able to successfully sign in with my SSO credentials, but afterwards the installer gets stuck with a loading symbol like the image below. I am never prompted to agree to the Software License Agreement. Why is the installer continuously loading forever when trying to sign in with SSO/Campus-Wide License? When trying to install MATLAB, I am able to successfully sign in with my SSO credentials, but afterwards the installer gets stuck with a loading symbol like the image below. I am never prompted to agree to the Software License Agreement. Why is the installer continuously loading forever when trying to sign in with SSO/Campus-Wide License? MATLAB Answers — New Questions
How to analyze every single pixels intensity in a video clip?
I need help get each single pixel’s intensity in a video clip (grayscale). For example, in a video clip containing 150×250 pixels and 1000 frames, I need to obtain the intensity one by one, either row-wise or column-wise.I need help get each single pixel’s intensity in a video clip (grayscale). For example, in a video clip containing 150×250 pixels and 1000 frames, I need to obtain the intensity one by one, either row-wise or column-wise. I need help get each single pixel’s intensity in a video clip (grayscale). For example, in a video clip containing 150×250 pixels and 1000 frames, I need to obtain the intensity one by one, either row-wise or column-wise. intensity, image analysis, pixel, matlab MATLAB Answers — New Questions
How do I get rid of the error “Functionality not supported with figures created with the uifigure function.”
I added this line to my startup.m so that the zoom and marker tools are available on the toolbar by default
set(groot,’defaultFigureCreateFcn’,@(fig,~)addToolbarExplorationButtons(fig))
but recently I have started getting the error
"Functionality not supported with figures created with the uifigure function."
when I create a uifigure.
How can I fix this?I added this line to my startup.m so that the zoom and marker tools are available on the toolbar by default
set(groot,’defaultFigureCreateFcn’,@(fig,~)addToolbarExplorationButtons(fig))
but recently I have started getting the error
"Functionality not supported with figures created with the uifigure function."
when I create a uifigure.
How can I fix this? I added this line to my startup.m so that the zoom and marker tools are available on the toolbar by default
set(groot,’defaultFigureCreateFcn’,@(fig,~)addToolbarExplorationButtons(fig))
but recently I have started getting the error
"Functionality not supported with figures created with the uifigure function."
when I create a uifigure.
How can I fix this? startup, exploration toolbar, toolbars MATLAB Answers — New Questions
Unwanted quotation marks when appending a table in pdf report
Hi,
I’m struggling with MATLAB Report Generator to append a table in a pdf. My table has string and float values. In the following code, mltable is displayed without quotation marks in MATLAB terminal but if I append it my pdf report, I get :
I looked at all the properties of mltableObj but couldn’t find anything to get rid of the quotation marks. Any suggestion? Should I use another object and/or function?
Thanks in advance!
clear all
clc
import mlreportgen.dom.*
import mlreportgen.report.*
d = Report(‘myMATLABTable’,’pdf’);
% Define the data
variableNames = {‘p_solMaxPower_MW’, ‘p_batNomVoltage_V’, ‘p_batNomPower_MW’};
descriptions = {‘Maximum Solar Power [MW]’, ‘Battery Nominal Voltage [V]’, ‘Battery Nominal Power [MW]’};
values = [10.0, 1000.0, 1.0];
% Convert cell arrays to character arrays
variableNames = char(variableNames);
descriptions = char(descriptions);
% Create and append the table
mltable = table(variableNames, descriptions, values’, ‘VariableNames’, {‘Name’, ‘Description’, ‘Value’});
mltableObj = MATLABTable(mltable);
mltableObj.Border = "solid";
mltableObj.BorderWidth = "1px";
mltableObj.ColSep = "solid";
mltableObj.RowSep = "solid";
mltableObj.HeaderRule = [];
mltableObj.HeaderRule.Border = ‘none’;
tbodyObj = mltableObj.Body;
tbodyObj.TableEntriesStyle = {Color(‘blue’)};
tbodyObj.TableEntriesHAlign = ‘center’;
append(d,mltableObj);
close(d);
rptview(d);Hi,
I’m struggling with MATLAB Report Generator to append a table in a pdf. My table has string and float values. In the following code, mltable is displayed without quotation marks in MATLAB terminal but if I append it my pdf report, I get :
I looked at all the properties of mltableObj but couldn’t find anything to get rid of the quotation marks. Any suggestion? Should I use another object and/or function?
Thanks in advance!
clear all
clc
import mlreportgen.dom.*
import mlreportgen.report.*
d = Report(‘myMATLABTable’,’pdf’);
% Define the data
variableNames = {‘p_solMaxPower_MW’, ‘p_batNomVoltage_V’, ‘p_batNomPower_MW’};
descriptions = {‘Maximum Solar Power [MW]’, ‘Battery Nominal Voltage [V]’, ‘Battery Nominal Power [MW]’};
values = [10.0, 1000.0, 1.0];
% Convert cell arrays to character arrays
variableNames = char(variableNames);
descriptions = char(descriptions);
% Create and append the table
mltable = table(variableNames, descriptions, values’, ‘VariableNames’, {‘Name’, ‘Description’, ‘Value’});
mltableObj = MATLABTable(mltable);
mltableObj.Border = "solid";
mltableObj.BorderWidth = "1px";
mltableObj.ColSep = "solid";
mltableObj.RowSep = "solid";
mltableObj.HeaderRule = [];
mltableObj.HeaderRule.Border = ‘none’;
tbodyObj = mltableObj.Body;
tbodyObj.TableEntriesStyle = {Color(‘blue’)};
tbodyObj.TableEntriesHAlign = ‘center’;
append(d,mltableObj);
close(d);
rptview(d); Hi,
I’m struggling with MATLAB Report Generator to append a table in a pdf. My table has string and float values. In the following code, mltable is displayed without quotation marks in MATLAB terminal but if I append it my pdf report, I get :
I looked at all the properties of mltableObj but couldn’t find anything to get rid of the quotation marks. Any suggestion? Should I use another object and/or function?
Thanks in advance!
clear all
clc
import mlreportgen.dom.*
import mlreportgen.report.*
d = Report(‘myMATLABTable’,’pdf’);
% Define the data
variableNames = {‘p_solMaxPower_MW’, ‘p_batNomVoltage_V’, ‘p_batNomPower_MW’};
descriptions = {‘Maximum Solar Power [MW]’, ‘Battery Nominal Voltage [V]’, ‘Battery Nominal Power [MW]’};
values = [10.0, 1000.0, 1.0];
% Convert cell arrays to character arrays
variableNames = char(variableNames);
descriptions = char(descriptions);
% Create and append the table
mltable = table(variableNames, descriptions, values’, ‘VariableNames’, {‘Name’, ‘Description’, ‘Value’});
mltableObj = MATLABTable(mltable);
mltableObj.Border = "solid";
mltableObj.BorderWidth = "1px";
mltableObj.ColSep = "solid";
mltableObj.RowSep = "solid";
mltableObj.HeaderRule = [];
mltableObj.HeaderRule.Border = ‘none’;
tbodyObj = mltableObj.Body;
tbodyObj.TableEntriesStyle = {Color(‘blue’)};
tbodyObj.TableEntriesHAlign = ‘center’;
append(d,mltableObj);
close(d);
rptview(d); pdf report, table, matlabtable MATLAB Answers — New Questions
I want to count the number of 0s in a binary sequence which occurs for n number of times, where n=1:25.
Suppose I have a binary sequence A=[0 0 0 1 0 0 1 0 1 0 0 0 0 0 1 0 0 0 1]
Then I want to count in how many cases 0 occurs consecutively for n number of times preceded and succeeded by 1.
Here the desired output would be-
for n=1- noofzeros=1
n=2 – noofzeros=1
n=3- noof zeros=2
n=4- no of zeros=0
n=5- noofzeros=1
and so on….Suppose I have a binary sequence A=[0 0 0 1 0 0 1 0 1 0 0 0 0 0 1 0 0 0 1]
Then I want to count in how many cases 0 occurs consecutively for n number of times preceded and succeeded by 1.
Here the desired output would be-
for n=1- noofzeros=1
n=2 – noofzeros=1
n=3- noof zeros=2
n=4- no of zeros=0
n=5- noofzeros=1
and so on…. Suppose I have a binary sequence A=[0 0 0 1 0 0 1 0 1 0 0 0 0 0 1 0 0 0 1]
Then I want to count in how many cases 0 occurs consecutively for n number of times preceded and succeeded by 1.
Here the desired output would be-
for n=1- noofzeros=1
n=2 – noofzeros=1
n=3- noof zeros=2
n=4- no of zeros=0
n=5- noofzeros=1
and so on…. binary MATLAB Answers — New Questions
inversing huge Y Matrix
Hello, I need to get Zbus for some short circuit study. The system is huge consisting of over 9000 buses. From psse, I found the ybus which is quite sparse and inversing it is giving me wrong results. Could anyone please tell me how to inverse such huge matrix to get zbus?Hello, I need to get Zbus for some short circuit study. The system is huge consisting of over 9000 buses. From psse, I found the ybus which is quite sparse and inversing it is giving me wrong results. Could anyone please tell me how to inverse such huge matrix to get zbus? Hello, I need to get Zbus for some short circuit study. The system is huge consisting of over 9000 buses. From psse, I found the ybus which is quite sparse and inversing it is giving me wrong results. Could anyone please tell me how to inverse such huge matrix to get zbus? ybus, zbus MATLAB Answers — New Questions
Where can I find my Support Cases in my MathWorks Account?
Where can I find my Support Cases in my MathWorks Account?Where can I find my Support Cases in my MathWorks Account? Where can I find my Support Cases in my MathWorks Account? MATLAB Answers — New Questions
Normalisation for extraction of spectral features and pump data for predictive maintenance purposes
Hello,
I have a project for which I need to make a supervised machine learning algorithm that can detect unbalance and misalignment faults in the healthy data for a centrifugal pump.
I have data in the time domain and data in the frequency domain (fft) and also the speed of rotation of the pump.
The problem is that one of the constraints is that I have to have 1 model for several pumps (with different rotation speeds, power, etc.). So I need a specific normalisation to extract the features.
This means that the peaks in the spectral domain will not be in the same place. How can I ‘normalise’ the data so that my model works with all types of pump?Hello,
I have a project for which I need to make a supervised machine learning algorithm that can detect unbalance and misalignment faults in the healthy data for a centrifugal pump.
I have data in the time domain and data in the frequency domain (fft) and also the speed of rotation of the pump.
The problem is that one of the constraints is that I have to have 1 model for several pumps (with different rotation speeds, power, etc.). So I need a specific normalisation to extract the features.
This means that the peaks in the spectral domain will not be in the same place. How can I ‘normalise’ the data so that my model works with all types of pump? Hello,
I have a project for which I need to make a supervised machine learning algorithm that can detect unbalance and misalignment faults in the healthy data for a centrifugal pump.
I have data in the time domain and data in the frequency domain (fft) and also the speed of rotation of the pump.
The problem is that one of the constraints is that I have to have 1 model for several pumps (with different rotation speeds, power, etc.). So I need a specific normalisation to extract the features.
This means that the peaks in the spectral domain will not be in the same place. How can I ‘normalise’ the data so that my model works with all types of pump? predictive maintenance, features, normalization, pump, diagnoticfeaturedesigner MATLAB Answers — New Questions