Category: Matlab
Category Archives: Matlab
Generate deadband smaller than Ts (sample time)
Hi,
I am working with MPC for control inverter.
the output MPC connected to GPIO DO.
however i need to add deadband between MPC and GPIO.
Ts = 50e-6. and i would like to generate deadband 1e-6.
1.how to generate deadband smaller than Ts in C2000 Simulink ?
2. If there is possible to use ePWM module, hiw to set up ePWM module ?Hi,
I am working with MPC for control inverter.
the output MPC connected to GPIO DO.
however i need to add deadband between MPC and GPIO.
Ts = 50e-6. and i would like to generate deadband 1e-6.
1.how to generate deadband smaller than Ts in C2000 Simulink ?
2. If there is possible to use ePWM module, hiw to set up ePWM module ? Hi,
I am working with MPC for control inverter.
the output MPC connected to GPIO DO.
however i need to add deadband between MPC and GPIO.
Ts = 50e-6. and i would like to generate deadband 1e-6.
1.how to generate deadband smaller than Ts in C2000 Simulink ?
2. If there is possible to use ePWM module, hiw to set up ePWM module ? c2000, mpc, gpio, epwm, simulink MATLAB Answers — New Questions
fixing clock frequency and sample time of control system model using hdl coder
I have built a fixed point PID controller in simulink and could generate the code using hdl coder for programming FPGA. The generated verilog code has additional inputs such as clock, clock enable. During simulation, I fixed the sample time of the discrete models to .01 seconds. I am unable to understand the difference between the input clock and the sample time. Could you please clarify? (btw My FPGA recieves external clock of 50MHz)I have built a fixed point PID controller in simulink and could generate the code using hdl coder for programming FPGA. The generated verilog code has additional inputs such as clock, clock enable. During simulation, I fixed the sample time of the discrete models to .01 seconds. I am unable to understand the difference between the input clock and the sample time. Could you please clarify? (btw My FPGA recieves external clock of 50MHz) I have built a fixed point PID controller in simulink and could generate the code using hdl coder for programming FPGA. The generated verilog code has additional inputs such as clock, clock enable. During simulation, I fixed the sample time of the discrete models to .01 seconds. I am unable to understand the difference between the input clock and the sample time. Could you please clarify? (btw My FPGA recieves external clock of 50MHz) pid MATLAB Answers — New Questions
How to Imorting a text file containig indexes and the coressponding elements of a matrix to matlab?
want to get a matrix from a text file that contains the corresponding elements and there indexes.want to get a matrix from a text file that contains the corresponding elements and there indexes. want to get a matrix from a text file that contains the corresponding elements and there indexes. .matrix file MATLAB Answers — New Questions
Find the max of a vector recursive
Hello all,
Im trying to find the max value of an element in a vector, for learning purposes Ineed to do this recursive. I have been trying this all over again but something goes terribly worng. Could anybody point out to me what I am doing wrong? Thanks in advance.
function output = recursive_max(input)
%%Write a function called recursive_max that finds the maximum element in a
%%vector. You are not allowed to use loops or any built-in functions other
%%than length. The sole output argument is the maximum value in the input
%%vector. Hint: the maximum value of a vector is the larger of its first
%%element and the maximum of the rest of the elements.
l = length(input);
if l == 1
output = recursive_max(input(end))
else
if input(end-1) >= input(end)
input(end) = [];
recursive_max(input);
end
input(end-1) = []
end
endHello all,
Im trying to find the max value of an element in a vector, for learning purposes Ineed to do this recursive. I have been trying this all over again but something goes terribly worng. Could anybody point out to me what I am doing wrong? Thanks in advance.
function output = recursive_max(input)
%%Write a function called recursive_max that finds the maximum element in a
%%vector. You are not allowed to use loops or any built-in functions other
%%than length. The sole output argument is the maximum value in the input
%%vector. Hint: the maximum value of a vector is the larger of its first
%%element and the maximum of the rest of the elements.
l = length(input);
if l == 1
output = recursive_max(input(end))
else
if input(end-1) >= input(end)
input(end) = [];
recursive_max(input);
end
input(end-1) = []
end
end Hello all,
Im trying to find the max value of an element in a vector, for learning purposes Ineed to do this recursive. I have been trying this all over again but something goes terribly worng. Could anybody point out to me what I am doing wrong? Thanks in advance.
function output = recursive_max(input)
%%Write a function called recursive_max that finds the maximum element in a
%%vector. You are not allowed to use loops or any built-in functions other
%%than length. The sole output argument is the maximum value in the input
%%vector. Hint: the maximum value of a vector is the larger of its first
%%element and the maximum of the rest of the elements.
l = length(input);
if l == 1
output = recursive_max(input(end))
else
if input(end-1) >= input(end)
input(end) = [];
recursive_max(input);
end
input(end-1) = []
end
end recursion MATLAB Answers — New Questions
How to add SE module in GoogLeNet for classification?
How to add SE module in GoogLeNet for classification?How to add SE module in GoogLeNet for classification? How to add SE module in GoogLeNet for classification? googlenet, semodule, classification MATLAB Answers — New Questions
How do I disable the Close button at the top right corner of figure window and the Close option in the title bar menu in MATLAB 7.6 (R2008a)?
I want to disable the Close button on the upper left corner of a figure window and the Close menu item in the Title bar menu in a GUI application.I want to disable the Close button on the upper left corner of a figure window and the Close menu item in the Title bar menu in a GUI application. I want to disable the Close button on the upper left corner of a figure window and the Close menu item in the Title bar menu in a GUI application. disable, close, button, closerequestfcn MATLAB Answers — New Questions
SURVEY BY MULTIPLE BACKSIGHT ANGLE MEASUREMENT
Calculate the approximate PT-TM06 coordinates of the point (M0, P0) using one of the methods taught in theoretical classes (e.g., Mayer’s method), using three of the targeted points (the configuration of the three chosen points should be the most appropriate for resolving the simple inverse intersection); you may (and should) also solve the problem graphically.
Determine the corrections to the coordinates (ΔM, ΔP) and the zero limb bearing (R0) using the Least Squares Method (LSM), using the algorithm for indirect measurements given in theoretical classes.
Determine the adjusted coordinates of the point in question and its elevation, taking the average (most probable value) of all obtained elevation values for the point; given the distance to the targeted points, you should consider the curvature of the Earth and the atmospheric refraction effect (k=0.14) in the elevation calculation.
I can atatch the measurements
The first point i was able to do (i think), the rest is what messes with my train of though
%Pontos visados
%Clérigos
clr_M = -40420.448;
clr_P = 164167.927;
clr_H = 141.13;
%Direta Progressiva (dp)
clr_ah_dp = 102.8444;
clr_av_dp = 97.7522;
%Inversa Regressiva (ir)
clr_ah_ir = 302.8566;
clr_av_ir = 302.2442;
%Inversa Progressiva (ip)
clr_ah_ip = 302.8561;
clr_av_ip = 302.2467;
%Direta Regressiva (dr)
clr_ah_dr = 102.8617;
clr_av_dr = 97.7503;
%Câmara municipal do porto
cm_M = -40088.726;
cm_P = 164636.884;
cm_H = 152.33;
%Direta Progressiva (dp)
cm_ah_dp = 129.6582;
cm_av_dp = 97.4767;
%Inversa Regressiva (ir)
cm_ah_ir = 329.6599;
cm_av_ir = 302.5056;
%Inversa Progressiva (ip)
cm_ah_ip =329.6628;
cm_av_ip =302.3095;
%Direta Regressiva (dr)
cm_ah_dr = 129.6708;
cm_av_dr = 97.4755;
%igreja da lapa
il_M = -40209.736;
il_P = 165426.432;
il_H = 176.03;
%Direta Progressiva (dp)
il_ah_dp = 137.6340 ;
il_av_dp = 97.6790;
%Inversa Regressiva (ir)
il_ah_ir = 337.6339;
il_av_ir = 302.3148;
%Inversa Progressiva (ip)
il_ah_ip = 337.6455;
il_av_ip = 302.3175;
%Direta Regressiva (dr)
il_ah_dr = 137.6501;
il_av_dr = 97.6786;
%Jornal de Noticias
jn_M = -39934.342;
jn_P = 165011.012;
jn_H = 170.79;
%Direta Progressiva (dp)
jn_ah_dp = 141.7560;
jn_av_dp = 97.2225;
%Inversa Regressiva (ir)
jn_ah_ir = 341.7596;
jn_av_ir = 302.7853;
%Inversa Progressiva (ip)
jn_ah_ip = 341.7649;
jn_av_ip = 302.7908;
%Direta Regressiva (dr)
jn_ah_dr = 141.7680;
jn_av_dr = 97.2106;
%Depósito de água
da_M = -39336.276;
da_P = 165413.16;
da_H = 185.48;
%Direta Progressiva (dp)
da_ah_dp = 163.9711;
da_av_dp = 97.1290;
%Inversa Regressiva (ir)
da_ah_ir = 363.9730;
da_av_ir = 302.8053;
%Inversa Progressiva (ip)
da_ah_ip = 363.9772;
da_av_ip = 302.8023;
%Direta Regressiva (dr)
da_ah_dr = 163.9848;
da_av_dr = 97.1911;
%Igreja do Bonfim
ib_M = -38614.9280;
ib_P = 164792.1040;
ib_H = 162.20;
%Direta Progressiva (dp)
ib_ah_dp = 194.7617;
ib_av_dp = 97.3887;
%Inversa Regressiva (ir)
ib_ah_ir = 394.7702;
ib_av_ir = 302.5992;
%Inversa Progressiva (ip)
ib_ah_ip = 394.7724;
ib_av_ip = 302.5994;
%Direta Regressiva (dr)
ib_ah_dr = 194.7772;
ib_av_dr = 97.3917;
%Gondomar(v.g.)
g_M = -33142.6520;
g_P = 163536.09;
g_H = 203.27;
%Direta Progressiva (dp)
g_ah_dp = 260.0913;
g_av_dp = 98.9460;
%Inversa Regressiva (ir)
g_ah_ir = 60.0908;
g_av_ir = 301.0498;
%Inversa Progressiva (ip)
g_ah_ip = 60.0992;
g_av_ip = 301.0477;
%Direta Regressiva (dr)
g_ah_dr = 260.0978;
g_av_dr = 98.9363;
%
%3 Pontos- Jornal de noticias, Igreja do bonfim e depósito de água-
dir_clr = ((clr_ah_dp+clr_ah_ir-200+clr_ah_ip-200+clr_ah_dr)/4)*(180/200);
dir_cm = ((cm_ah_dp+cm_ah_ir-200+cm_ah_ip-200+cm_ah_dr)/4)*(180/200);
dir_il = ((il_ah_dp+il_ah_ir-200+il_ah_ip-200+il_ah_dr)/4)*(180/200);
dir_jn = ((jn_ah_dp+jn_ah_ir-200+jn_ah_ip-200+jn_ah_dr)/4)*(180/200);
dir_da = ((da_ah_dp+da_ah_ir-200+da_ah_ip-200+da_ah_dr)/4)*(180/200);
dir_ib = ((ib_ah_dp+ib_ah_ir-200+ib_ah_ip-200+ib_ah_dr)/4)*(180/200);
dir_g = ((g_ah_dp+g_ah_ir-200+g_ah_ip-200+g_ah_dr+400)/4)*(180/200);
%Calculo rumos BA e BC (ponto A – Câmara do Porto, B- Depósito de água e C-
%Igreja do bonfim)
R_BA = atand((cm_M-da_M)/(cm_P-da_P))+180;
R_BC = atand((ib_M-da_M)/(ib_P-da_P))+180;
%Calculo do angulo phi
a_phi=R_BA-R_BC;
%Calculo distâncias horizontais
d_BA = sqrt((cm_M-da_M)^2+(cm_P-da_P)^2);
d_BC = sqrt((ib_M-da_M)^2+(ib_P-da_P)^2);
%Calculo do R
a_alpha = dir_da – dir_cm;
a_beta = dir_ib – dir_da;
R = 360-(a_alpha+a_beta+a_phi);
%Calculo do S
S=(d_BC+sind(a_alpha))/(d_BA*sind(a_beta));
%Calculo do gama
a_gama = atand(sind(R)/(S+cosd(R)))+90;
%Calculo tetha
a_theta=R-a_gama;
%calculo phi1
a_phi1= 180-(a_theta+a_alpha);
%Calculo distancia Camara do Porto(A) ao ponto P(local observação)
d_AP=d_BA*((sind(a_phi1))/sind(a_alpha));
%Calculo Rumo AP
RAP = R_BA-180+a_theta;
%Coordenadas aproximadas M0 e P0
M0 = cm_M + d_AP*sind(RAP);
P0 = cm_P + d_AP*cosd(RAP);
%Distancia ao ponto aproximado
d_clr = sqrt((M0-clr_M)^2+(P0-clr_P)^2);
d_cm = sqrt((M0-cm_M)^2+(P0-cm_P)^2);
d_il = sqrt((M0-il_M)^2+(P0-il_P)^2);
d_jn = sqrt((M0-jn_M)^2+(P0-jn_P)^2);
d_da = sqrt((M0-da_M)^2+(P0-da_P)^2);
d_ib = sqrt((M0-ib_M)^2+(P0-ib_P)^2);
d_g = sqrt((M0-g_M)^2+(P0-g_P)^2);
%Rumos ao ponto aproximado
r_clr = atand((clr_M-M0)/(clr_P-P0));
r_cm = atand((cm_M-M0)/(cm_P-P0));
r_il = atand((il_M-M0)/(il_P-P0))+360;
r_jn = atand((jn_M-M0)/(jn_P-P0));
r_da = atand((da_M-M0)/(da_P-P0));
r_ib = atand((ib_M-M0)/(ib_P-P0))+360;
r_g = atand((g_M-M0)/(g_P-P0))+360;
%Matriz dos coeficientes
A = [-(clr_P-P0)/d_clr^2*180/pi (clr_M-M0)/d_clr^2*180/pi -1;
-(cm_P-P0)/d_cm^2*180/pi (cm_M-M0)/d_cm^2*180/pi -1;
-(il_P-P0)/d_il^2*180/pi (il_M-M0)/d_il^2*180/pi -1;
-(jn_P-P0)/d_jn^2*180/pi (jn_M-M0)/d_jn^2*180/pi -1;
-(da_P-P0)/d_da^2*180/pi (da_M-M0)/d_da^2*180/pi -1;
-(ib_P-P0)/d_ib^2*180/pi (ib_M-M0)/d_ib^2*180/pi -1;
-(g_P-P0)/d_g^2*180/pi (g_M-M0)/d_g^2*180/pi -1];
%Vetor b
b = [dir_clr-r_clr;
dir_cm-r_cm;
dir_il-r_il;
dir_jn-r_jn;
dir_da-r_da;
dir_ib-r_ib;
dir_g-r_g];
%Matriz dos pesos
W=eye(7);
%Matriz equações normais
N=A’*W*A ;
%Calculo correções coordenadas
delta = inv(N) * A’ * W * b;
%coordenadas compensadas
M0_f=M0+delta(1);
P0_f=P0+delta(2);Calculate the approximate PT-TM06 coordinates of the point (M0, P0) using one of the methods taught in theoretical classes (e.g., Mayer’s method), using three of the targeted points (the configuration of the three chosen points should be the most appropriate for resolving the simple inverse intersection); you may (and should) also solve the problem graphically.
Determine the corrections to the coordinates (ΔM, ΔP) and the zero limb bearing (R0) using the Least Squares Method (LSM), using the algorithm for indirect measurements given in theoretical classes.
Determine the adjusted coordinates of the point in question and its elevation, taking the average (most probable value) of all obtained elevation values for the point; given the distance to the targeted points, you should consider the curvature of the Earth and the atmospheric refraction effect (k=0.14) in the elevation calculation.
I can atatch the measurements
The first point i was able to do (i think), the rest is what messes with my train of though
%Pontos visados
%Clérigos
clr_M = -40420.448;
clr_P = 164167.927;
clr_H = 141.13;
%Direta Progressiva (dp)
clr_ah_dp = 102.8444;
clr_av_dp = 97.7522;
%Inversa Regressiva (ir)
clr_ah_ir = 302.8566;
clr_av_ir = 302.2442;
%Inversa Progressiva (ip)
clr_ah_ip = 302.8561;
clr_av_ip = 302.2467;
%Direta Regressiva (dr)
clr_ah_dr = 102.8617;
clr_av_dr = 97.7503;
%Câmara municipal do porto
cm_M = -40088.726;
cm_P = 164636.884;
cm_H = 152.33;
%Direta Progressiva (dp)
cm_ah_dp = 129.6582;
cm_av_dp = 97.4767;
%Inversa Regressiva (ir)
cm_ah_ir = 329.6599;
cm_av_ir = 302.5056;
%Inversa Progressiva (ip)
cm_ah_ip =329.6628;
cm_av_ip =302.3095;
%Direta Regressiva (dr)
cm_ah_dr = 129.6708;
cm_av_dr = 97.4755;
%igreja da lapa
il_M = -40209.736;
il_P = 165426.432;
il_H = 176.03;
%Direta Progressiva (dp)
il_ah_dp = 137.6340 ;
il_av_dp = 97.6790;
%Inversa Regressiva (ir)
il_ah_ir = 337.6339;
il_av_ir = 302.3148;
%Inversa Progressiva (ip)
il_ah_ip = 337.6455;
il_av_ip = 302.3175;
%Direta Regressiva (dr)
il_ah_dr = 137.6501;
il_av_dr = 97.6786;
%Jornal de Noticias
jn_M = -39934.342;
jn_P = 165011.012;
jn_H = 170.79;
%Direta Progressiva (dp)
jn_ah_dp = 141.7560;
jn_av_dp = 97.2225;
%Inversa Regressiva (ir)
jn_ah_ir = 341.7596;
jn_av_ir = 302.7853;
%Inversa Progressiva (ip)
jn_ah_ip = 341.7649;
jn_av_ip = 302.7908;
%Direta Regressiva (dr)
jn_ah_dr = 141.7680;
jn_av_dr = 97.2106;
%Depósito de água
da_M = -39336.276;
da_P = 165413.16;
da_H = 185.48;
%Direta Progressiva (dp)
da_ah_dp = 163.9711;
da_av_dp = 97.1290;
%Inversa Regressiva (ir)
da_ah_ir = 363.9730;
da_av_ir = 302.8053;
%Inversa Progressiva (ip)
da_ah_ip = 363.9772;
da_av_ip = 302.8023;
%Direta Regressiva (dr)
da_ah_dr = 163.9848;
da_av_dr = 97.1911;
%Igreja do Bonfim
ib_M = -38614.9280;
ib_P = 164792.1040;
ib_H = 162.20;
%Direta Progressiva (dp)
ib_ah_dp = 194.7617;
ib_av_dp = 97.3887;
%Inversa Regressiva (ir)
ib_ah_ir = 394.7702;
ib_av_ir = 302.5992;
%Inversa Progressiva (ip)
ib_ah_ip = 394.7724;
ib_av_ip = 302.5994;
%Direta Regressiva (dr)
ib_ah_dr = 194.7772;
ib_av_dr = 97.3917;
%Gondomar(v.g.)
g_M = -33142.6520;
g_P = 163536.09;
g_H = 203.27;
%Direta Progressiva (dp)
g_ah_dp = 260.0913;
g_av_dp = 98.9460;
%Inversa Regressiva (ir)
g_ah_ir = 60.0908;
g_av_ir = 301.0498;
%Inversa Progressiva (ip)
g_ah_ip = 60.0992;
g_av_ip = 301.0477;
%Direta Regressiva (dr)
g_ah_dr = 260.0978;
g_av_dr = 98.9363;
%
%3 Pontos- Jornal de noticias, Igreja do bonfim e depósito de água-
dir_clr = ((clr_ah_dp+clr_ah_ir-200+clr_ah_ip-200+clr_ah_dr)/4)*(180/200);
dir_cm = ((cm_ah_dp+cm_ah_ir-200+cm_ah_ip-200+cm_ah_dr)/4)*(180/200);
dir_il = ((il_ah_dp+il_ah_ir-200+il_ah_ip-200+il_ah_dr)/4)*(180/200);
dir_jn = ((jn_ah_dp+jn_ah_ir-200+jn_ah_ip-200+jn_ah_dr)/4)*(180/200);
dir_da = ((da_ah_dp+da_ah_ir-200+da_ah_ip-200+da_ah_dr)/4)*(180/200);
dir_ib = ((ib_ah_dp+ib_ah_ir-200+ib_ah_ip-200+ib_ah_dr)/4)*(180/200);
dir_g = ((g_ah_dp+g_ah_ir-200+g_ah_ip-200+g_ah_dr+400)/4)*(180/200);
%Calculo rumos BA e BC (ponto A – Câmara do Porto, B- Depósito de água e C-
%Igreja do bonfim)
R_BA = atand((cm_M-da_M)/(cm_P-da_P))+180;
R_BC = atand((ib_M-da_M)/(ib_P-da_P))+180;
%Calculo do angulo phi
a_phi=R_BA-R_BC;
%Calculo distâncias horizontais
d_BA = sqrt((cm_M-da_M)^2+(cm_P-da_P)^2);
d_BC = sqrt((ib_M-da_M)^2+(ib_P-da_P)^2);
%Calculo do R
a_alpha = dir_da – dir_cm;
a_beta = dir_ib – dir_da;
R = 360-(a_alpha+a_beta+a_phi);
%Calculo do S
S=(d_BC+sind(a_alpha))/(d_BA*sind(a_beta));
%Calculo do gama
a_gama = atand(sind(R)/(S+cosd(R)))+90;
%Calculo tetha
a_theta=R-a_gama;
%calculo phi1
a_phi1= 180-(a_theta+a_alpha);
%Calculo distancia Camara do Porto(A) ao ponto P(local observação)
d_AP=d_BA*((sind(a_phi1))/sind(a_alpha));
%Calculo Rumo AP
RAP = R_BA-180+a_theta;
%Coordenadas aproximadas M0 e P0
M0 = cm_M + d_AP*sind(RAP);
P0 = cm_P + d_AP*cosd(RAP);
%Distancia ao ponto aproximado
d_clr = sqrt((M0-clr_M)^2+(P0-clr_P)^2);
d_cm = sqrt((M0-cm_M)^2+(P0-cm_P)^2);
d_il = sqrt((M0-il_M)^2+(P0-il_P)^2);
d_jn = sqrt((M0-jn_M)^2+(P0-jn_P)^2);
d_da = sqrt((M0-da_M)^2+(P0-da_P)^2);
d_ib = sqrt((M0-ib_M)^2+(P0-ib_P)^2);
d_g = sqrt((M0-g_M)^2+(P0-g_P)^2);
%Rumos ao ponto aproximado
r_clr = atand((clr_M-M0)/(clr_P-P0));
r_cm = atand((cm_M-M0)/(cm_P-P0));
r_il = atand((il_M-M0)/(il_P-P0))+360;
r_jn = atand((jn_M-M0)/(jn_P-P0));
r_da = atand((da_M-M0)/(da_P-P0));
r_ib = atand((ib_M-M0)/(ib_P-P0))+360;
r_g = atand((g_M-M0)/(g_P-P0))+360;
%Matriz dos coeficientes
A = [-(clr_P-P0)/d_clr^2*180/pi (clr_M-M0)/d_clr^2*180/pi -1;
-(cm_P-P0)/d_cm^2*180/pi (cm_M-M0)/d_cm^2*180/pi -1;
-(il_P-P0)/d_il^2*180/pi (il_M-M0)/d_il^2*180/pi -1;
-(jn_P-P0)/d_jn^2*180/pi (jn_M-M0)/d_jn^2*180/pi -1;
-(da_P-P0)/d_da^2*180/pi (da_M-M0)/d_da^2*180/pi -1;
-(ib_P-P0)/d_ib^2*180/pi (ib_M-M0)/d_ib^2*180/pi -1;
-(g_P-P0)/d_g^2*180/pi (g_M-M0)/d_g^2*180/pi -1];
%Vetor b
b = [dir_clr-r_clr;
dir_cm-r_cm;
dir_il-r_il;
dir_jn-r_jn;
dir_da-r_da;
dir_ib-r_ib;
dir_g-r_g];
%Matriz dos pesos
W=eye(7);
%Matriz equações normais
N=A’*W*A ;
%Calculo correções coordenadas
delta = inv(N) * A’ * W * b;
%coordenadas compensadas
M0_f=M0+delta(1);
P0_f=P0+delta(2); Calculate the approximate PT-TM06 coordinates of the point (M0, P0) using one of the methods taught in theoretical classes (e.g., Mayer’s method), using three of the targeted points (the configuration of the three chosen points should be the most appropriate for resolving the simple inverse intersection); you may (and should) also solve the problem graphically.
Determine the corrections to the coordinates (ΔM, ΔP) and the zero limb bearing (R0) using the Least Squares Method (LSM), using the algorithm for indirect measurements given in theoretical classes.
Determine the adjusted coordinates of the point in question and its elevation, taking the average (most probable value) of all obtained elevation values for the point; given the distance to the targeted points, you should consider the curvature of the Earth and the atmospheric refraction effect (k=0.14) in the elevation calculation.
I can atatch the measurements
The first point i was able to do (i think), the rest is what messes with my train of though
%Pontos visados
%Clérigos
clr_M = -40420.448;
clr_P = 164167.927;
clr_H = 141.13;
%Direta Progressiva (dp)
clr_ah_dp = 102.8444;
clr_av_dp = 97.7522;
%Inversa Regressiva (ir)
clr_ah_ir = 302.8566;
clr_av_ir = 302.2442;
%Inversa Progressiva (ip)
clr_ah_ip = 302.8561;
clr_av_ip = 302.2467;
%Direta Regressiva (dr)
clr_ah_dr = 102.8617;
clr_av_dr = 97.7503;
%Câmara municipal do porto
cm_M = -40088.726;
cm_P = 164636.884;
cm_H = 152.33;
%Direta Progressiva (dp)
cm_ah_dp = 129.6582;
cm_av_dp = 97.4767;
%Inversa Regressiva (ir)
cm_ah_ir = 329.6599;
cm_av_ir = 302.5056;
%Inversa Progressiva (ip)
cm_ah_ip =329.6628;
cm_av_ip =302.3095;
%Direta Regressiva (dr)
cm_ah_dr = 129.6708;
cm_av_dr = 97.4755;
%igreja da lapa
il_M = -40209.736;
il_P = 165426.432;
il_H = 176.03;
%Direta Progressiva (dp)
il_ah_dp = 137.6340 ;
il_av_dp = 97.6790;
%Inversa Regressiva (ir)
il_ah_ir = 337.6339;
il_av_ir = 302.3148;
%Inversa Progressiva (ip)
il_ah_ip = 337.6455;
il_av_ip = 302.3175;
%Direta Regressiva (dr)
il_ah_dr = 137.6501;
il_av_dr = 97.6786;
%Jornal de Noticias
jn_M = -39934.342;
jn_P = 165011.012;
jn_H = 170.79;
%Direta Progressiva (dp)
jn_ah_dp = 141.7560;
jn_av_dp = 97.2225;
%Inversa Regressiva (ir)
jn_ah_ir = 341.7596;
jn_av_ir = 302.7853;
%Inversa Progressiva (ip)
jn_ah_ip = 341.7649;
jn_av_ip = 302.7908;
%Direta Regressiva (dr)
jn_ah_dr = 141.7680;
jn_av_dr = 97.2106;
%Depósito de água
da_M = -39336.276;
da_P = 165413.16;
da_H = 185.48;
%Direta Progressiva (dp)
da_ah_dp = 163.9711;
da_av_dp = 97.1290;
%Inversa Regressiva (ir)
da_ah_ir = 363.9730;
da_av_ir = 302.8053;
%Inversa Progressiva (ip)
da_ah_ip = 363.9772;
da_av_ip = 302.8023;
%Direta Regressiva (dr)
da_ah_dr = 163.9848;
da_av_dr = 97.1911;
%Igreja do Bonfim
ib_M = -38614.9280;
ib_P = 164792.1040;
ib_H = 162.20;
%Direta Progressiva (dp)
ib_ah_dp = 194.7617;
ib_av_dp = 97.3887;
%Inversa Regressiva (ir)
ib_ah_ir = 394.7702;
ib_av_ir = 302.5992;
%Inversa Progressiva (ip)
ib_ah_ip = 394.7724;
ib_av_ip = 302.5994;
%Direta Regressiva (dr)
ib_ah_dr = 194.7772;
ib_av_dr = 97.3917;
%Gondomar(v.g.)
g_M = -33142.6520;
g_P = 163536.09;
g_H = 203.27;
%Direta Progressiva (dp)
g_ah_dp = 260.0913;
g_av_dp = 98.9460;
%Inversa Regressiva (ir)
g_ah_ir = 60.0908;
g_av_ir = 301.0498;
%Inversa Progressiva (ip)
g_ah_ip = 60.0992;
g_av_ip = 301.0477;
%Direta Regressiva (dr)
g_ah_dr = 260.0978;
g_av_dr = 98.9363;
%
%3 Pontos- Jornal de noticias, Igreja do bonfim e depósito de água-
dir_clr = ((clr_ah_dp+clr_ah_ir-200+clr_ah_ip-200+clr_ah_dr)/4)*(180/200);
dir_cm = ((cm_ah_dp+cm_ah_ir-200+cm_ah_ip-200+cm_ah_dr)/4)*(180/200);
dir_il = ((il_ah_dp+il_ah_ir-200+il_ah_ip-200+il_ah_dr)/4)*(180/200);
dir_jn = ((jn_ah_dp+jn_ah_ir-200+jn_ah_ip-200+jn_ah_dr)/4)*(180/200);
dir_da = ((da_ah_dp+da_ah_ir-200+da_ah_ip-200+da_ah_dr)/4)*(180/200);
dir_ib = ((ib_ah_dp+ib_ah_ir-200+ib_ah_ip-200+ib_ah_dr)/4)*(180/200);
dir_g = ((g_ah_dp+g_ah_ir-200+g_ah_ip-200+g_ah_dr+400)/4)*(180/200);
%Calculo rumos BA e BC (ponto A – Câmara do Porto, B- Depósito de água e C-
%Igreja do bonfim)
R_BA = atand((cm_M-da_M)/(cm_P-da_P))+180;
R_BC = atand((ib_M-da_M)/(ib_P-da_P))+180;
%Calculo do angulo phi
a_phi=R_BA-R_BC;
%Calculo distâncias horizontais
d_BA = sqrt((cm_M-da_M)^2+(cm_P-da_P)^2);
d_BC = sqrt((ib_M-da_M)^2+(ib_P-da_P)^2);
%Calculo do R
a_alpha = dir_da – dir_cm;
a_beta = dir_ib – dir_da;
R = 360-(a_alpha+a_beta+a_phi);
%Calculo do S
S=(d_BC+sind(a_alpha))/(d_BA*sind(a_beta));
%Calculo do gama
a_gama = atand(sind(R)/(S+cosd(R)))+90;
%Calculo tetha
a_theta=R-a_gama;
%calculo phi1
a_phi1= 180-(a_theta+a_alpha);
%Calculo distancia Camara do Porto(A) ao ponto P(local observação)
d_AP=d_BA*((sind(a_phi1))/sind(a_alpha));
%Calculo Rumo AP
RAP = R_BA-180+a_theta;
%Coordenadas aproximadas M0 e P0
M0 = cm_M + d_AP*sind(RAP);
P0 = cm_P + d_AP*cosd(RAP);
%Distancia ao ponto aproximado
d_clr = sqrt((M0-clr_M)^2+(P0-clr_P)^2);
d_cm = sqrt((M0-cm_M)^2+(P0-cm_P)^2);
d_il = sqrt((M0-il_M)^2+(P0-il_P)^2);
d_jn = sqrt((M0-jn_M)^2+(P0-jn_P)^2);
d_da = sqrt((M0-da_M)^2+(P0-da_P)^2);
d_ib = sqrt((M0-ib_M)^2+(P0-ib_P)^2);
d_g = sqrt((M0-g_M)^2+(P0-g_P)^2);
%Rumos ao ponto aproximado
r_clr = atand((clr_M-M0)/(clr_P-P0));
r_cm = atand((cm_M-M0)/(cm_P-P0));
r_il = atand((il_M-M0)/(il_P-P0))+360;
r_jn = atand((jn_M-M0)/(jn_P-P0));
r_da = atand((da_M-M0)/(da_P-P0));
r_ib = atand((ib_M-M0)/(ib_P-P0))+360;
r_g = atand((g_M-M0)/(g_P-P0))+360;
%Matriz dos coeficientes
A = [-(clr_P-P0)/d_clr^2*180/pi (clr_M-M0)/d_clr^2*180/pi -1;
-(cm_P-P0)/d_cm^2*180/pi (cm_M-M0)/d_cm^2*180/pi -1;
-(il_P-P0)/d_il^2*180/pi (il_M-M0)/d_il^2*180/pi -1;
-(jn_P-P0)/d_jn^2*180/pi (jn_M-M0)/d_jn^2*180/pi -1;
-(da_P-P0)/d_da^2*180/pi (da_M-M0)/d_da^2*180/pi -1;
-(ib_P-P0)/d_ib^2*180/pi (ib_M-M0)/d_ib^2*180/pi -1;
-(g_P-P0)/d_g^2*180/pi (g_M-M0)/d_g^2*180/pi -1];
%Vetor b
b = [dir_clr-r_clr;
dir_cm-r_cm;
dir_il-r_il;
dir_jn-r_jn;
dir_da-r_da;
dir_ib-r_ib;
dir_g-r_g];
%Matriz dos pesos
W=eye(7);
%Matriz equações normais
N=A’*W*A ;
%Calculo correções coordenadas
delta = inv(N) * A’ * W * b;
%coordenadas compensadas
M0_f=M0+delta(1);
P0_f=P0+delta(2); topography, matrices MATLAB Answers — New Questions
What does the ‘contribution of each term to the predicted value’ mean in the plotLocalEffects function in MATLAB?
I used the plotLocalEffects function to get visualization of important features for my GAM model. I do not understand how the feature contributions in the local effects plot was obtained mathematically. How different is it from the SHAPLEY or LIME?I used the plotLocalEffects function to get visualization of important features for my GAM model. I do not understand how the feature contributions in the local effects plot was obtained mathematically. How different is it from the SHAPLEY or LIME? I used the plotLocalEffects function to get visualization of important features for my GAM model. I do not understand how the feature contributions in the local effects plot was obtained mathematically. How different is it from the SHAPLEY or LIME? explainable ai MATLAB Answers — New Questions
Installing the WEC-Sim in MATLAB
Hi all, Am Mubeena currently doing my PhD in University of Wollongong. I have downloaded WEC-SIM tool and tried to integrate in MATLAb. After installing the WEC-SIM tool in MATLAB am facing difficulty. the tool doesn’t appear in the Simulink library browser. I have installed as the user manual theory. Could please help me in how to figure it out?
Thanks
MubeenaHi all, Am Mubeena currently doing my PhD in University of Wollongong. I have downloaded WEC-SIM tool and tried to integrate in MATLAb. After installing the WEC-SIM tool in MATLAB am facing difficulty. the tool doesn’t appear in the Simulink library browser. I have installed as the user manual theory. Could please help me in how to figure it out?
Thanks
Mubeena Hi all, Am Mubeena currently doing my PhD in University of Wollongong. I have downloaded WEC-SIM tool and tried to integrate in MATLAb. After installing the WEC-SIM tool in MATLAB am facing difficulty. the tool doesn’t appear in the Simulink library browser. I have installed as the user manual theory. Could please help me in how to figure it out?
Thanks
Mubeena wec-sim tool MATLAB Answers — New Questions
Support package for IDS
Hey there,
I´m working with the Image Acquisition Toolbox and an IDS-USB3.0 camera (UEye UI-3880CP-C-HQ Rev.2). The camera works perfect in the IDS-Software, but in Matlab it works really, really slow (framerate is 5FPS [it should be up to 58], sensor Control is super slow as well…). I haven´tfound any Support package for the IDS?
Is there a way to improve the performance in Matlab?
Thanks in advance!Hey there,
I´m working with the Image Acquisition Toolbox and an IDS-USB3.0 camera (UEye UI-3880CP-C-HQ Rev.2). The camera works perfect in the IDS-Software, but in Matlab it works really, really slow (framerate is 5FPS [it should be up to 58], sensor Control is super slow as well…). I haven´tfound any Support package for the IDS?
Is there a way to improve the performance in Matlab?
Thanks in advance! Hey there,
I´m working with the Image Acquisition Toolbox and an IDS-USB3.0 camera (UEye UI-3880CP-C-HQ Rev.2). The camera works perfect in the IDS-Software, but in Matlab it works really, really slow (framerate is 5FPS [it should be up to 58], sensor Control is super slow as well…). I haven´tfound any Support package for the IDS?
Is there a way to improve the performance in Matlab?
Thanks in advance! #ids, #imageacquisitiontool, #supportpackage # MATLAB Answers — New Questions
How to install Classification Learner app?
My MATLAB course assignment requires to use Classification Learner and my MATLAB system doesn’t have this. I went on MATLAB’s helppage and saw "classificationLearner" function, but it doesn’t run (probably I’m not running right). Please advise to solve this issue.My MATLAB course assignment requires to use Classification Learner and my MATLAB system doesn’t have this. I went on MATLAB’s helppage and saw "classificationLearner" function, but it doesn’t run (probably I’m not running right). Please advise to solve this issue. My MATLAB course assignment requires to use Classification Learner and my MATLAB system doesn’t have this. I went on MATLAB’s helppage and saw "classificationLearner" function, but it doesn’t run (probably I’m not running right). Please advise to solve this issue. matlab, classification, application MATLAB Answers — New Questions
Unrecognized function or variable in a code
% param value
clear all; close all;
% p is constant and q varies
k0 = 0.0000169; u=0.6; p=536.2; q=0.0000376;
% your function
k = @(t,u) (k0 + (p*k0.^u-q*k0).*t.^a/gamma(a+1) +(p*k0.^u-q*k0).*(p*u*k0.^u-q).*t.^(2*a)/gamma(2*a+1)…
+(p*k0.^u-q*k0).*((p*u*k0.^u-q).^2-p*u.*(u-1)*k0.^(u-1)./2).*t.^(3*a)/gamma(3*a+1));
% grid
%t = linspace(0,0.1);
%u = linspace(0.3,0.9);
%[T,U] = meshgrid(t,q);
t = linspace(0,0.1,50);
a = linspace(0.3,0.9,50);
[T,A] = meshgrid(t,a);
% evaluate function
Z = k(T,A);
% plot
figure
surf(T,A,Z)
%surf(T,Q,Z,’facecolor’,’none’)
xlabel(‘t’);
ylabel(‘mu’);
zlabel(‘k(t)’)% param value
clear all; close all;
% p is constant and q varies
k0 = 0.0000169; u=0.6; p=536.2; q=0.0000376;
% your function
k = @(t,u) (k0 + (p*k0.^u-q*k0).*t.^a/gamma(a+1) +(p*k0.^u-q*k0).*(p*u*k0.^u-q).*t.^(2*a)/gamma(2*a+1)…
+(p*k0.^u-q*k0).*((p*u*k0.^u-q).^2-p*u.*(u-1)*k0.^(u-1)./2).*t.^(3*a)/gamma(3*a+1));
% grid
%t = linspace(0,0.1);
%u = linspace(0.3,0.9);
%[T,U] = meshgrid(t,q);
t = linspace(0,0.1,50);
a = linspace(0.3,0.9,50);
[T,A] = meshgrid(t,a);
% evaluate function
Z = k(T,A);
% plot
figure
surf(T,A,Z)
%surf(T,Q,Z,’facecolor’,’none’)
xlabel(‘t’);
ylabel(‘mu’);
zlabel(‘k(t)’) % param value
clear all; close all;
% p is constant and q varies
k0 = 0.0000169; u=0.6; p=536.2; q=0.0000376;
% your function
k = @(t,u) (k0 + (p*k0.^u-q*k0).*t.^a/gamma(a+1) +(p*k0.^u-q*k0).*(p*u*k0.^u-q).*t.^(2*a)/gamma(2*a+1)…
+(p*k0.^u-q*k0).*((p*u*k0.^u-q).^2-p*u.*(u-1)*k0.^(u-1)./2).*t.^(3*a)/gamma(3*a+1));
% grid
%t = linspace(0,0.1);
%u = linspace(0.3,0.9);
%[T,U] = meshgrid(t,q);
t = linspace(0,0.1,50);
a = linspace(0.3,0.9,50);
[T,A] = meshgrid(t,a);
% evaluate function
Z = k(T,A);
% plot
figure
surf(T,A,Z)
%surf(T,Q,Z,’facecolor’,’none’)
xlabel(‘t’);
ylabel(‘mu’);
zlabel(‘k(t)’) code MATLAB Answers — New Questions
What changes should i have to make in my code to remove the error (“Error using contourf Z must be at least a 2×2 matrix.”)
%——Creating a strain matrix———–%
E = zeros(2*(size(K1,1)-1),2*(size(K1,1)-1))
for j = 1: (size(K1,1)-1)
for i = 1: (size(K1,1)-1)
v = [zpk1(j,i);zpk2(j,i);zpk1(j,i+1);zpk2(j,i+1);zpk1(j+1,i+1);zpk2(j+1,i+1);zpk1(j+1,i);zpk2(j+1,i)];
e1= strain1(v);
e2= strain2(v);
e3= strain3(v);
e4= strain4(v);
E((2*j-1),(2*i-1)) = e1(1);
E((2*j-1),2*i) = e2(1);
E(2*j,(2*i-1)) = e4(1);
E(2*j,2*i) = e3(1);
end
end
su = round(4*d/g)+1 ;
r = E((((su-1)- round(d/g)):-1:1),(su-1));
p = E((((su-1)- round(d/g)):-1:1),(su));
st = (p+r)./(1.5*(10)^(-4));
m = g*(size(r)-1);
H = 0:g:(m);
h = H./10;
writematrix(st)
type ‘st.txt’;
writematrix(h)
type ‘h.txt’;
plot(h,st)
xlim([0 1.5])
xlabel("X2/d",’fontsize’,14)
ylabel("Normalised Strain along vertical path", ‘fontsize’,13)
legend("d/w = 0.5")
saveas(gcf,’plot.png’)
contourf(st)
colorbar
saveas(gcf,’contour.png’)%——Creating a strain matrix———–%
E = zeros(2*(size(K1,1)-1),2*(size(K1,1)-1))
for j = 1: (size(K1,1)-1)
for i = 1: (size(K1,1)-1)
v = [zpk1(j,i);zpk2(j,i);zpk1(j,i+1);zpk2(j,i+1);zpk1(j+1,i+1);zpk2(j+1,i+1);zpk1(j+1,i);zpk2(j+1,i)];
e1= strain1(v);
e2= strain2(v);
e3= strain3(v);
e4= strain4(v);
E((2*j-1),(2*i-1)) = e1(1);
E((2*j-1),2*i) = e2(1);
E(2*j,(2*i-1)) = e4(1);
E(2*j,2*i) = e3(1);
end
end
su = round(4*d/g)+1 ;
r = E((((su-1)- round(d/g)):-1:1),(su-1));
p = E((((su-1)- round(d/g)):-1:1),(su));
st = (p+r)./(1.5*(10)^(-4));
m = g*(size(r)-1);
H = 0:g:(m);
h = H./10;
writematrix(st)
type ‘st.txt’;
writematrix(h)
type ‘h.txt’;
plot(h,st)
xlim([0 1.5])
xlabel("X2/d",’fontsize’,14)
ylabel("Normalised Strain along vertical path", ‘fontsize’,13)
legend("d/w = 0.5")
saveas(gcf,’plot.png’)
contourf(st)
colorbar
saveas(gcf,’contour.png’) %——Creating a strain matrix———–%
E = zeros(2*(size(K1,1)-1),2*(size(K1,1)-1))
for j = 1: (size(K1,1)-1)
for i = 1: (size(K1,1)-1)
v = [zpk1(j,i);zpk2(j,i);zpk1(j,i+1);zpk2(j,i+1);zpk1(j+1,i+1);zpk2(j+1,i+1);zpk1(j+1,i);zpk2(j+1,i)];
e1= strain1(v);
e2= strain2(v);
e3= strain3(v);
e4= strain4(v);
E((2*j-1),(2*i-1)) = e1(1);
E((2*j-1),2*i) = e2(1);
E(2*j,(2*i-1)) = e4(1);
E(2*j,2*i) = e3(1);
end
end
su = round(4*d/g)+1 ;
r = E((((su-1)- round(d/g)):-1:1),(su-1));
p = E((((su-1)- round(d/g)):-1:1),(su));
st = (p+r)./(1.5*(10)^(-4));
m = g*(size(r)-1);
H = 0:g:(m);
h = H./10;
writematrix(st)
type ‘st.txt’;
writematrix(h)
type ‘h.txt’;
plot(h,st)
xlim([0 1.5])
xlabel("X2/d",’fontsize’,14)
ylabel("Normalised Strain along vertical path", ‘fontsize’,13)
legend("d/w = 0.5")
saveas(gcf,’plot.png’)
contourf(st)
colorbar
saveas(gcf,’contour.png’) matlab, fem, abaqus MATLAB Answers — New Questions
Does the MATLAB has a convolutional LSTM layer
I am trying to implement a convolutional lstm network for image classification. As the existing lstm/bilstm layers are for 1D vector/series, I am unable to have an lstm layer rigt after a convolutional layer. May I know is there any ways to implement a convolutional lstm in Matlab.I am trying to implement a convolutional lstm network for image classification. As the existing lstm/bilstm layers are for 1D vector/series, I am unable to have an lstm layer rigt after a convolutional layer. May I know is there any ways to implement a convolutional lstm in Matlab. I am trying to implement a convolutional lstm network for image classification. As the existing lstm/bilstm layers are for 1D vector/series, I am unable to have an lstm layer rigt after a convolutional layer. May I know is there any ways to implement a convolutional lstm in Matlab. image processing, video processing MATLAB Answers — New Questions
Connecting the 3 phase inverter output to the inport of the induction machine(squirrel cage) block
As you can see in the attached image, I am trying to connect the 3 phase output AC signal from the DC-AC inverter to the inport of the squirrel cage induction motor block. It seems that the signal should be converted to some form to be connected to the inport.
Any advice?
Thank you
Daryll DavisAs you can see in the attached image, I am trying to connect the 3 phase output AC signal from the DC-AC inverter to the inport of the squirrel cage induction motor block. It seems that the signal should be converted to some form to be connected to the inport.
Any advice?
Thank you
Daryll Davis As you can see in the attached image, I am trying to connect the 3 phase output AC signal from the DC-AC inverter to the inport of the squirrel cage induction motor block. It seems that the signal should be converted to some form to be connected to the inport.
Any advice?
Thank you
Daryll Davis induction machine, squirrel cage induction motor, 3 phase inverter, expandable 3 phase MATLAB Answers — New Questions
How to use rlocfind in root locus.
How do i use rlocfind command to find the range of values of K (feedback gain) for which the closed-loop ststem is stable. For example for the sytem below:
In the tutorial it is hinted that rlocfind is the correct appraoch:
Many thanks in advance,How do i use rlocfind command to find the range of values of K (feedback gain) for which the closed-loop ststem is stable. For example for the sytem below:
In the tutorial it is hinted that rlocfind is the correct appraoch:
Many thanks in advance, How do i use rlocfind command to find the range of values of K (feedback gain) for which the closed-loop ststem is stable. For example for the sytem below:
In the tutorial it is hinted that rlocfind is the correct appraoch:
Many thanks in advance, root locus, rlocfind MATLAB Answers — New Questions
Finding Transfer Function from Step Response
A bit of context:
I’m in a stundent project at my universtiy. We’re desingning and building an Mechanical ventilator for Corona-Patients. I’m having some trouble with the control loop of the system.
The ouput of the control loop is controlling a proportional valve. The purpose of this is to reach the desired pressure (Setpoint) in less than 3 seconds. I’m using a PID control, yet it’s not tuned correctly. That’s why I decided to go to basics, and get the transfer function from a step response, to then simulate the different constants in MATLAB.
The following step response was achieved by opening the proportional valve fully, and waited till the Setpoint was achieved. There’s a 1 bar relative pressure in the system. Any pressure above 25mbar flows out, through a PEEP valve. The proplem with the system is that we can’t overshot, because we cannot get rid of this pressure as the patient is inhaling.
If someone could help me, calculate the transfer function of the following step response, I would be really gratefull.
Thanks in advance.A bit of context:
I’m in a stundent project at my universtiy. We’re desingning and building an Mechanical ventilator for Corona-Patients. I’m having some trouble with the control loop of the system.
The ouput of the control loop is controlling a proportional valve. The purpose of this is to reach the desired pressure (Setpoint) in less than 3 seconds. I’m using a PID control, yet it’s not tuned correctly. That’s why I decided to go to basics, and get the transfer function from a step response, to then simulate the different constants in MATLAB.
The following step response was achieved by opening the proportional valve fully, and waited till the Setpoint was achieved. There’s a 1 bar relative pressure in the system. Any pressure above 25mbar flows out, through a PEEP valve. The proplem with the system is that we can’t overshot, because we cannot get rid of this pressure as the patient is inhaling.
If someone could help me, calculate the transfer function of the following step response, I would be really gratefull.
Thanks in advance. A bit of context:
I’m in a stundent project at my universtiy. We’re desingning and building an Mechanical ventilator for Corona-Patients. I’m having some trouble with the control loop of the system.
The ouput of the control loop is controlling a proportional valve. The purpose of this is to reach the desired pressure (Setpoint) in less than 3 seconds. I’m using a PID control, yet it’s not tuned correctly. That’s why I decided to go to basics, and get the transfer function from a step response, to then simulate the different constants in MATLAB.
The following step response was achieved by opening the proportional valve fully, and waited till the Setpoint was achieved. There’s a 1 bar relative pressure in the system. Any pressure above 25mbar flows out, through a PEEP valve. The proplem with the system is that we can’t overshot, because we cannot get rid of this pressure as the patient is inhaling.
If someone could help me, calculate the transfer function of the following step response, I would be really gratefull.
Thanks in advance. control_loop, pid, transfer function, step response MATLAB Answers — New Questions
How are the starting points for surrogate optimization chosen?
I have a question regarding the "starting points" or the random points chosen to construct the surrogate. Is it possible to access the function that determines how the surrogate selects its random points?
I am testing different algorithms in MATLAB for a global optimization problem, and I always perform 50 different trials of 100 iterations each. The surrogate algorithm consistently produces very similar starting points and performs exceptionally well with them. The documentation describes this process as a pseudorandom sequence (https://en.wikipedia.org/wiki/Low-discrepancy_sequence), but in my opinion, this does not explain the similarity of the points shown on the cost function graph, especially since no random seed is set.
The graph displays the mean, minimum, and maximum of the cost function for the surrogate algorithm with random starts (over the initial X condition in the options of the surrogate) called Surrogate RNG and the surrogate algorithm. It is interesting to note how close the minimum and maximum of the cost function of the surrogate are.
Is it possible to have more options for surrogate optimization (such as those available in https://github.com/Piiloblondie/MATSuMoTo)? Additionally, is it possible to access the function for determining the starting points so that I can try it with other algorithms?
What could be the reason for the starting points to be so close together even when no random seed is chosen?
For additional context, I use 8-13 different variables, all of which are doubles. I also use one linear constraint that can be implemented in the function.I have a question regarding the "starting points" or the random points chosen to construct the surrogate. Is it possible to access the function that determines how the surrogate selects its random points?
I am testing different algorithms in MATLAB for a global optimization problem, and I always perform 50 different trials of 100 iterations each. The surrogate algorithm consistently produces very similar starting points and performs exceptionally well with them. The documentation describes this process as a pseudorandom sequence (https://en.wikipedia.org/wiki/Low-discrepancy_sequence), but in my opinion, this does not explain the similarity of the points shown on the cost function graph, especially since no random seed is set.
The graph displays the mean, minimum, and maximum of the cost function for the surrogate algorithm with random starts (over the initial X condition in the options of the surrogate) called Surrogate RNG and the surrogate algorithm. It is interesting to note how close the minimum and maximum of the cost function of the surrogate are.
Is it possible to have more options for surrogate optimization (such as those available in https://github.com/Piiloblondie/MATSuMoTo)? Additionally, is it possible to access the function for determining the starting points so that I can try it with other algorithms?
What could be the reason for the starting points to be so close together even when no random seed is chosen?
For additional context, I use 8-13 different variables, all of which are doubles. I also use one linear constraint that can be implemented in the function. I have a question regarding the "starting points" or the random points chosen to construct the surrogate. Is it possible to access the function that determines how the surrogate selects its random points?
I am testing different algorithms in MATLAB for a global optimization problem, and I always perform 50 different trials of 100 iterations each. The surrogate algorithm consistently produces very similar starting points and performs exceptionally well with them. The documentation describes this process as a pseudorandom sequence (https://en.wikipedia.org/wiki/Low-discrepancy_sequence), but in my opinion, this does not explain the similarity of the points shown on the cost function graph, especially since no random seed is set.
The graph displays the mean, minimum, and maximum of the cost function for the surrogate algorithm with random starts (over the initial X condition in the options of the surrogate) called Surrogate RNG and the surrogate algorithm. It is interesting to note how close the minimum and maximum of the cost function of the surrogate are.
Is it possible to have more options for surrogate optimization (such as those available in https://github.com/Piiloblondie/MATSuMoTo)? Additionally, is it possible to access the function for determining the starting points so that I can try it with other algorithms?
What could be the reason for the starting points to be so close together even when no random seed is chosen?
For additional context, I use 8-13 different variables, all of which are doubles. I also use one linear constraint that can be implemented in the function. surrogate, global optimization toolbox MATLAB Answers — New Questions
Parsing and editing txt file line by line
Hello,
How to automatically transform a txt file in this form by removing strings start and end:
Onset,Annotation
+234.3428079,start
+244.1317829,end
+255.1007751,start
+263.0000000,end
to this form:
+234.3428079,+244.1317829
+255.1007751,+263.0000000
RegardsHello,
How to automatically transform a txt file in this form by removing strings start and end:
Onset,Annotation
+234.3428079,start
+244.1317829,end
+255.1007751,start
+263.0000000,end
to this form:
+234.3428079,+244.1317829
+255.1007751,+263.0000000
Regards Hello,
How to automatically transform a txt file in this form by removing strings start and end:
Onset,Annotation
+234.3428079,start
+244.1317829,end
+255.1007751,start
+263.0000000,end
to this form:
+234.3428079,+244.1317829
+255.1007751,+263.0000000
Regards parsing txt files MATLAB Answers — New Questions
MATLAB not indexing table with correct data type, how to specify data type when indexing table?
I wrote a script that takes in an excel table using the "readtable" command.
inputTable = readtable(completeTableFilePath,’Sheet’,sheetChoiceFileName,’TextType’,’string’);
This, to my knowledge, should import all the cells of the excel file as strings. One part of the excel file is a column that has hex numbers (they cold be just "92" or "13C" etc…).
I had a really long excel table (around 300 lines) that had this column of hex numbers. I tried the program with a smaller table, maybe only 8 lines, and now it is having issues, particularly in the hex column.
The code:
% I just added these for testing (the idName)
idName = upper(inputTable{currentRowNumber,’ID’});
idName
if upper(inputTable{currentRowNumber,’ID’}) ~= "TBD"
if upper(inputTable{currentRowNumber,’ID’}) ~= recurringID
recurringID = upper(inputTable{currentRowNumber,’ID’});
messageIDDecimal = hex2dec(recurringID);
end
end
As I said, I changed nothing about this between runs, it works perfectly with the large table and it does not work with the smaller table. When I try to run it with the smaller table (which is just the larger table with a lot of the rows chopped off) I get idName as a "double" data type.
I figured I could fix this, by instead of relying on MATLAB to have the correct data type (which it should anyways because I specified so earlier!) I force the data type of strings using string(…).
% idName for testing
idName = upper(string(inputTable{currentRowNumber,’ID’}));
idName
if upper(string(inputTable{currentRowNumber,’ID’})) ~= "TBD"
if upper(string(inputTable{currentRowNumber,’ID’})) ~= recurringID
recurringID = upper(string(inputTable{currentRowNumber,’ID’}));
messageIDDecimal = hex2dec(recurringID);
end
end
I ran the above code on the smaller table and got the error: <missing> string element not supported; error on line with the hex2dec. idName shows up as <missing>.
I changed the code again to show the raw table indexing:
% idName for testing
idName = upper(string(inputTable{currentRowNumber,’ID’}));
idName
idTest = inputTable{currentRowNumber,’ID’};
idTest
if upper(string(inputTable{currentRowNumber,’ID’})) ~= "TBD"
if upper(string(inputTable{currentRowNumber,’ID’})) ~= recurringID
recurringID = upper(string(inputTable{currentRowNumber,’ID’}));
messageIDDecimal = hex2dec(recurringID);
end
end
idTest was coming up as the double data type, until the final go. idName was <missing> and idTest was "NaN". To my knowledge, "NaN" is "Not a Number". It is giving an error because it’s trying to input a hex number as a regular double data type. I cannot find a way to fix this. I already specified that the table is to be imported as strings. I cannot cast to this, because its not just holding the data, but being the wrong type. It is throwing an error and not holding the data at all.
There is nothing I can do, unless there is some way to make MATLAB only import as a specific data type. I am having a lot of issues, because MATLAB assumes data types. Maybe coming from C just has me think differently. I can see how it can be useful, but the fact that there is no way around it (that I know of), makes it not useful.
I ran the script with "idName" and "idTest" on the larget excel table. It properly imported them as strings. I was able to index and both idTest and idName showed as strings, even the hex numbers that only had the regular 0-9 numbers. So it is not the code. It is just MATLAB sometimes deciding to import as strings and sometimes to not.I wrote a script that takes in an excel table using the "readtable" command.
inputTable = readtable(completeTableFilePath,’Sheet’,sheetChoiceFileName,’TextType’,’string’);
This, to my knowledge, should import all the cells of the excel file as strings. One part of the excel file is a column that has hex numbers (they cold be just "92" or "13C" etc…).
I had a really long excel table (around 300 lines) that had this column of hex numbers. I tried the program with a smaller table, maybe only 8 lines, and now it is having issues, particularly in the hex column.
The code:
% I just added these for testing (the idName)
idName = upper(inputTable{currentRowNumber,’ID’});
idName
if upper(inputTable{currentRowNumber,’ID’}) ~= "TBD"
if upper(inputTable{currentRowNumber,’ID’}) ~= recurringID
recurringID = upper(inputTable{currentRowNumber,’ID’});
messageIDDecimal = hex2dec(recurringID);
end
end
As I said, I changed nothing about this between runs, it works perfectly with the large table and it does not work with the smaller table. When I try to run it with the smaller table (which is just the larger table with a lot of the rows chopped off) I get idName as a "double" data type.
I figured I could fix this, by instead of relying on MATLAB to have the correct data type (which it should anyways because I specified so earlier!) I force the data type of strings using string(…).
% idName for testing
idName = upper(string(inputTable{currentRowNumber,’ID’}));
idName
if upper(string(inputTable{currentRowNumber,’ID’})) ~= "TBD"
if upper(string(inputTable{currentRowNumber,’ID’})) ~= recurringID
recurringID = upper(string(inputTable{currentRowNumber,’ID’}));
messageIDDecimal = hex2dec(recurringID);
end
end
I ran the above code on the smaller table and got the error: <missing> string element not supported; error on line with the hex2dec. idName shows up as <missing>.
I changed the code again to show the raw table indexing:
% idName for testing
idName = upper(string(inputTable{currentRowNumber,’ID’}));
idName
idTest = inputTable{currentRowNumber,’ID’};
idTest
if upper(string(inputTable{currentRowNumber,’ID’})) ~= "TBD"
if upper(string(inputTable{currentRowNumber,’ID’})) ~= recurringID
recurringID = upper(string(inputTable{currentRowNumber,’ID’}));
messageIDDecimal = hex2dec(recurringID);
end
end
idTest was coming up as the double data type, until the final go. idName was <missing> and idTest was "NaN". To my knowledge, "NaN" is "Not a Number". It is giving an error because it’s trying to input a hex number as a regular double data type. I cannot find a way to fix this. I already specified that the table is to be imported as strings. I cannot cast to this, because its not just holding the data, but being the wrong type. It is throwing an error and not holding the data at all.
There is nothing I can do, unless there is some way to make MATLAB only import as a specific data type. I am having a lot of issues, because MATLAB assumes data types. Maybe coming from C just has me think differently. I can see how it can be useful, but the fact that there is no way around it (that I know of), makes it not useful.
I ran the script with "idName" and "idTest" on the larget excel table. It properly imported them as strings. I was able to index and both idTest and idName showed as strings, even the hex numbers that only had the regular 0-9 numbers. So it is not the code. It is just MATLAB sometimes deciding to import as strings and sometimes to not. I wrote a script that takes in an excel table using the "readtable" command.
inputTable = readtable(completeTableFilePath,’Sheet’,sheetChoiceFileName,’TextType’,’string’);
This, to my knowledge, should import all the cells of the excel file as strings. One part of the excel file is a column that has hex numbers (they cold be just "92" or "13C" etc…).
I had a really long excel table (around 300 lines) that had this column of hex numbers. I tried the program with a smaller table, maybe only 8 lines, and now it is having issues, particularly in the hex column.
The code:
% I just added these for testing (the idName)
idName = upper(inputTable{currentRowNumber,’ID’});
idName
if upper(inputTable{currentRowNumber,’ID’}) ~= "TBD"
if upper(inputTable{currentRowNumber,’ID’}) ~= recurringID
recurringID = upper(inputTable{currentRowNumber,’ID’});
messageIDDecimal = hex2dec(recurringID);
end
end
As I said, I changed nothing about this between runs, it works perfectly with the large table and it does not work with the smaller table. When I try to run it with the smaller table (which is just the larger table with a lot of the rows chopped off) I get idName as a "double" data type.
I figured I could fix this, by instead of relying on MATLAB to have the correct data type (which it should anyways because I specified so earlier!) I force the data type of strings using string(…).
% idName for testing
idName = upper(string(inputTable{currentRowNumber,’ID’}));
idName
if upper(string(inputTable{currentRowNumber,’ID’})) ~= "TBD"
if upper(string(inputTable{currentRowNumber,’ID’})) ~= recurringID
recurringID = upper(string(inputTable{currentRowNumber,’ID’}));
messageIDDecimal = hex2dec(recurringID);
end
end
I ran the above code on the smaller table and got the error: <missing> string element not supported; error on line with the hex2dec. idName shows up as <missing>.
I changed the code again to show the raw table indexing:
% idName for testing
idName = upper(string(inputTable{currentRowNumber,’ID’}));
idName
idTest = inputTable{currentRowNumber,’ID’};
idTest
if upper(string(inputTable{currentRowNumber,’ID’})) ~= "TBD"
if upper(string(inputTable{currentRowNumber,’ID’})) ~= recurringID
recurringID = upper(string(inputTable{currentRowNumber,’ID’}));
messageIDDecimal = hex2dec(recurringID);
end
end
idTest was coming up as the double data type, until the final go. idName was <missing> and idTest was "NaN". To my knowledge, "NaN" is "Not a Number". It is giving an error because it’s trying to input a hex number as a regular double data type. I cannot find a way to fix this. I already specified that the table is to be imported as strings. I cannot cast to this, because its not just holding the data, but being the wrong type. It is throwing an error and not holding the data at all.
There is nothing I can do, unless there is some way to make MATLAB only import as a specific data type. I am having a lot of issues, because MATLAB assumes data types. Maybe coming from C just has me think differently. I can see how it can be useful, but the fact that there is no way around it (that I know of), makes it not useful.
I ran the script with "idName" and "idTest" on the larget excel table. It properly imported them as strings. I was able to index and both idTest and idName showed as strings, even the hex numbers that only had the regular 0-9 numbers. So it is not the code. It is just MATLAB sometimes deciding to import as strings and sometimes to not. table, importing excel data, data import, data types MATLAB Answers — New Questions