Tag Archives: matlab
How can I upgrade my MATLAB Parallel Server cluster to the new version?
I would like to install the new version of MATLAB Parallel Server on my cluster. How can I do this?I would like to install the new version of MATLAB Parallel Server on my cluster. How can I do this? I would like to install the new version of MATLAB Parallel Server on my cluster. How can I do this? MATLAB Answers — New Questions
Use a single variable name/label with the dot notation, to get access to a table content
Hi, I have a table called "mydata"
>> class(mydata)
ans = ‘table’
from which I usually retreive data (stored in its columns) throught the following dot notation command:
mydata.BLUE
mydata.GREEN
mydata.WHITE
…
This time, I would like to use a single "table variable name/label" which contains all the "columns names"
label = {‘BLUE’,’GREEN’,’WHITE’}
in order to get access to all the data I need. Something like this, that obviously does not work:
for i = 1 : 3
mydata.label(i)
end
Any suggestion?
P.S.: I am not sure if I used the correct matlab terminology to explain my question and for the corresponding title. If both title and question are not clear, I will change them.Hi, I have a table called "mydata"
>> class(mydata)
ans = ‘table’
from which I usually retreive data (stored in its columns) throught the following dot notation command:
mydata.BLUE
mydata.GREEN
mydata.WHITE
…
This time, I would like to use a single "table variable name/label" which contains all the "columns names"
label = {‘BLUE’,’GREEN’,’WHITE’}
in order to get access to all the data I need. Something like this, that obviously does not work:
for i = 1 : 3
mydata.label(i)
end
Any suggestion?
P.S.: I am not sure if I used the correct matlab terminology to explain my question and for the corresponding title. If both title and question are not clear, I will change them. Hi, I have a table called "mydata"
>> class(mydata)
ans = ‘table’
from which I usually retreive data (stored in its columns) throught the following dot notation command:
mydata.BLUE
mydata.GREEN
mydata.WHITE
…
This time, I would like to use a single "table variable name/label" which contains all the "columns names"
label = {‘BLUE’,’GREEN’,’WHITE’}
in order to get access to all the data I need. Something like this, that obviously does not work:
for i = 1 : 3
mydata.label(i)
end
Any suggestion?
P.S.: I am not sure if I used the correct matlab terminology to explain my question and for the corresponding title. If both title and question are not clear, I will change them. dot notation, table MATLAB Answers — New Questions
Why did CD folder; give such a goofy error message when I just forgot ()
It works other places but suddenly I can change directory
K>> apploc
apploc =
‘C:UsersCPSLabDocumentsOdorChoiceDev’
K>> cd apploc
Error using cd
Unable to change current folder to ‘C:UsersCPSLabDocumentsOdorChoiceDevapploc’ (Name is
nonexistent or not a folder).
Why did it add the variable name to the value of the variable instead of just reminding me I forgot the parentheses
cd (apploc)It works other places but suddenly I can change directory
K>> apploc
apploc =
‘C:UsersCPSLabDocumentsOdorChoiceDev’
K>> cd apploc
Error using cd
Unable to change current folder to ‘C:UsersCPSLabDocumentsOdorChoiceDevapploc’ (Name is
nonexistent or not a folder).
Why did it add the variable name to the value of the variable instead of just reminding me I forgot the parentheses
cd (apploc) It works other places but suddenly I can change directory
K>> apploc
apploc =
‘C:UsersCPSLabDocumentsOdorChoiceDev’
K>> cd apploc
Error using cd
Unable to change current folder to ‘C:UsersCPSLabDocumentsOdorChoiceDevapploc’ (Name is
nonexistent or not a folder).
Why did it add the variable name to the value of the variable instead of just reminding me I forgot the parentheses
cd (apploc) cd fail MATLAB Answers — New Questions
Converting result after substituting numerical values into symbolic expression not possible. Matlab creates new symbolic variables by complex symbolic expression.
I have 22 symbolic variables, which I create different subexpressions with. Then I mathematically combine all these subexpression in one big expression according to the calculation I have to perform. I do these steps to keep some readability. However, matlab automatically creates new variables in the final expression, whereby they are named sigmas. When I then substitute numerical values into the symbolic variables, I get a complex result, which I can convert into a double precision number. However, I need to compute the derivative first and then substitute numerical values and at that point I get the error that it is not possible to convert them because symbolic variabls remains in the expression. I suppose that’s because of the new sigma variables. I tried vpa(), double(), simplify() but I do not get it solved. Does someone have an idea how I could handle that ? You can see that the derivative result is displayed with a D if you open the result and not sigma can be seen like it is displayed in the script.
syms T_NTC NTC_R NTC_B2585 R1509 R1510 R1507 S3V3S_A Ron LeakageCurrent GainError OffsetError VOLT_REF_3V INLError DNLError S3V3S_A_Ripple PSRR ResolutionADC
syms R1508 R1511 ADC2ADC_GainError ADC2ADC_OffsetError ADC2ADC_Isolation
%% Resistor network TEMP_DCB
R_NTC = NTC_R.*exp(NTC_B2585*(1./(T_NTC)-1/298.15));
Rs_TEMP_DCB = R1509 + 1./(1./R1510+1./R_NTC+1./R1507);
TEMP_DCB = S3V3S_A.*(R_NTC.*R1510./(R_NTC+R1510))./(R_NTC.*R1510./(R_NTC+R1510)+R1507) + (Rs_TEMP_DCB+Ron).*LeakageCurrent;
ADC_error_TEMP_DCB = GainError.*TEMP_DCB./VOLT_REF_3V + OffsetError + INLError + DNLError + S3V3S_A_Ripple*10.^(-PSRR/20).*2.^ResolutionADC./VOLT_REF_3V;
TEMP_DCB_ADCRawValue = round(TEMP_DCB.*2^ResolutionADC./VOLT_REF_3V + ADC_error_TEMP_DCB);
%% Resistor network 3V3S_A
Rs_VOLT_3V3S_A = R1508.*R1511./(R1508+R1511);
VOLT_3V3S_A = S3V3S_A.*R1511./(R1511+R1508) + (Rs_VOLT_3V3S_A+Ron).*LeakageCurrent;
ADC_error_3V3S_A = (GainError+ADC2ADC_GainError).*VOLT_3V3S_A./VOLT_REF_3V + OffsetError + ADC2ADC_OffsetError + ADC2ADC_Isolation + INLError + DNLError + S3V3S_A_Ripple*10.^(-PSRR/20).*2.^ResolutionADC./VOLT_REF_3V;
VOLT_3V3S_A_ADCRawValue = round(VOLT_3V3S_A.*2^ResolutionADC./VOLT_REF_3V + ADC_error_3V3S_A);
%% Ratio TEMP_DCB/VOLT_3V3S_A
y = TEMP_DCB_ADCRawValue./VOLT_3V3S_A_ADCRawValue
%% Derivatives
dy_dNTC_R = diff(y, NTC_R);
dy_dNTC_B2585 = diff(y, NTC_B2585);
dy_dR1509 = diff(y, R1509);
dy_dR1510 = diff(y, R1510);
dy_dR1507 = diff(y, R1507);
dy_dS3V3S_A = diff(y, S3V3S_A);
dy_dRon = diff(y, Ron);
dy_dLeakageCurrent = diff(y, LeakageCurrent);
dy_dGainError = diff(y, GainError);
dy_dVOLT_REF_3V = diff(y, VOLT_REF_3V);
dy_dOffsetError = diff(y, OffsetError);
dy_dINLError = diff(y, INLError);
dy_dDNLError = diff(y, DNLError);
dy_dS3V3S_A_Ripple = diff(y, S3V3S_A_Ripple);
dy_dPSRR = diff(y, PSRR);
dy_dResolutionADC = diff(y, ResolutionADC);
dy_dR1508 = diff(y, R1508);
dy_dR1511 = diff(y, R1511);
dy_dADC2ADC_GainError = diff(y, ADC2ADC_GainError);
dy_dADC2ADC_OffsetError = diff(y, ADC2ADC_OffsetError);
dy_dADC2ADC_Isolation = diff(y, ADC2ADC_Isolation);
%% Define working points
% Define your working point values
T_NTC_wp1 = 130 + 273.15;
NTC_R_wp1 = 5e3;
NTC_B2585_wp1 = 3420;
R1509_wp1 = 1e3;
R1510_wp1 = 20e3;
R1507_wp1 = 2e3;
S3V3S_A_wp1 = 3.33;
Ron_wp1 = 500;
LeakageCurrent_wp1 = 0;
GainError_wp1 = 0;
OffsetError_wp1 = 0;
VOLT_REF_3V_wp1 = 3;
INLError_wp1 = 0;
DNLError_wp1 = 0;
S3V3S_A_Ripple_wp1 = 10e-3;
PSRR_wp1 = 57;
ResolutionADC_wp1 = 12;
R1508_wp1 = 1e3;
R1511_wp1 = 1e3;
ADC2ADC_GainError_wp1 = 0;
ADC2ADC_OffsetError_wp1 = 0;
ADC2ADC_Isolation_wp1 = 0;
%% Combine working points into a vector
WP1 = [T_NTC_wp1 NTC_R_wp1 NTC_B2585_wp1 R1509_wp1 R1510_wp1 R1507_wp1 S3V3S_A_wp1 Ron_wp1 …
LeakageCurrent_wp1 GainError_wp1 OffsetError_wp1 VOLT_REF_3V_wp1 INLError_wp1 …
DNLError_wp1 S3V3S_A_Ripple_wp1 PSRR_wp1 ResolutionADC_wp1 R1508_wp1 R1511_wp1 …
ADC2ADC_GainError_wp1 ADC2ADC_OffsetError_wp1 ADC2ADC_Isolation_wp1];
%% Calculate sensitivity
symbols = [T_NTC NTC_R NTC_B2585 R1509 R1510 R1507 S3V3S_A Ron LeakageCurrent GainError OffsetError …
VOLT_REF_3V INLError DNLError S3V3S_A_Ripple PSRR ResolutionADC R1508 R1511 ADC2ADC_GainError …
ADC2ADC_OffsetError ADC2ADC_Isolation];
S_NTC_R_wp1 = (subs(dy_dNTC_R, symbols, WP1) * NTC_R_wp1) / subs(y, symbols, WP1)
% S_NTC_R_wp1_num = double(S_NTC_R_wp1);
S_NTC_R_wp1_num = vpa(S_NTC_R_wp1);I have 22 symbolic variables, which I create different subexpressions with. Then I mathematically combine all these subexpression in one big expression according to the calculation I have to perform. I do these steps to keep some readability. However, matlab automatically creates new variables in the final expression, whereby they are named sigmas. When I then substitute numerical values into the symbolic variables, I get a complex result, which I can convert into a double precision number. However, I need to compute the derivative first and then substitute numerical values and at that point I get the error that it is not possible to convert them because symbolic variabls remains in the expression. I suppose that’s because of the new sigma variables. I tried vpa(), double(), simplify() but I do not get it solved. Does someone have an idea how I could handle that ? You can see that the derivative result is displayed with a D if you open the result and not sigma can be seen like it is displayed in the script.
syms T_NTC NTC_R NTC_B2585 R1509 R1510 R1507 S3V3S_A Ron LeakageCurrent GainError OffsetError VOLT_REF_3V INLError DNLError S3V3S_A_Ripple PSRR ResolutionADC
syms R1508 R1511 ADC2ADC_GainError ADC2ADC_OffsetError ADC2ADC_Isolation
%% Resistor network TEMP_DCB
R_NTC = NTC_R.*exp(NTC_B2585*(1./(T_NTC)-1/298.15));
Rs_TEMP_DCB = R1509 + 1./(1./R1510+1./R_NTC+1./R1507);
TEMP_DCB = S3V3S_A.*(R_NTC.*R1510./(R_NTC+R1510))./(R_NTC.*R1510./(R_NTC+R1510)+R1507) + (Rs_TEMP_DCB+Ron).*LeakageCurrent;
ADC_error_TEMP_DCB = GainError.*TEMP_DCB./VOLT_REF_3V + OffsetError + INLError + DNLError + S3V3S_A_Ripple*10.^(-PSRR/20).*2.^ResolutionADC./VOLT_REF_3V;
TEMP_DCB_ADCRawValue = round(TEMP_DCB.*2^ResolutionADC./VOLT_REF_3V + ADC_error_TEMP_DCB);
%% Resistor network 3V3S_A
Rs_VOLT_3V3S_A = R1508.*R1511./(R1508+R1511);
VOLT_3V3S_A = S3V3S_A.*R1511./(R1511+R1508) + (Rs_VOLT_3V3S_A+Ron).*LeakageCurrent;
ADC_error_3V3S_A = (GainError+ADC2ADC_GainError).*VOLT_3V3S_A./VOLT_REF_3V + OffsetError + ADC2ADC_OffsetError + ADC2ADC_Isolation + INLError + DNLError + S3V3S_A_Ripple*10.^(-PSRR/20).*2.^ResolutionADC./VOLT_REF_3V;
VOLT_3V3S_A_ADCRawValue = round(VOLT_3V3S_A.*2^ResolutionADC./VOLT_REF_3V + ADC_error_3V3S_A);
%% Ratio TEMP_DCB/VOLT_3V3S_A
y = TEMP_DCB_ADCRawValue./VOLT_3V3S_A_ADCRawValue
%% Derivatives
dy_dNTC_R = diff(y, NTC_R);
dy_dNTC_B2585 = diff(y, NTC_B2585);
dy_dR1509 = diff(y, R1509);
dy_dR1510 = diff(y, R1510);
dy_dR1507 = diff(y, R1507);
dy_dS3V3S_A = diff(y, S3V3S_A);
dy_dRon = diff(y, Ron);
dy_dLeakageCurrent = diff(y, LeakageCurrent);
dy_dGainError = diff(y, GainError);
dy_dVOLT_REF_3V = diff(y, VOLT_REF_3V);
dy_dOffsetError = diff(y, OffsetError);
dy_dINLError = diff(y, INLError);
dy_dDNLError = diff(y, DNLError);
dy_dS3V3S_A_Ripple = diff(y, S3V3S_A_Ripple);
dy_dPSRR = diff(y, PSRR);
dy_dResolutionADC = diff(y, ResolutionADC);
dy_dR1508 = diff(y, R1508);
dy_dR1511 = diff(y, R1511);
dy_dADC2ADC_GainError = diff(y, ADC2ADC_GainError);
dy_dADC2ADC_OffsetError = diff(y, ADC2ADC_OffsetError);
dy_dADC2ADC_Isolation = diff(y, ADC2ADC_Isolation);
%% Define working points
% Define your working point values
T_NTC_wp1 = 130 + 273.15;
NTC_R_wp1 = 5e3;
NTC_B2585_wp1 = 3420;
R1509_wp1 = 1e3;
R1510_wp1 = 20e3;
R1507_wp1 = 2e3;
S3V3S_A_wp1 = 3.33;
Ron_wp1 = 500;
LeakageCurrent_wp1 = 0;
GainError_wp1 = 0;
OffsetError_wp1 = 0;
VOLT_REF_3V_wp1 = 3;
INLError_wp1 = 0;
DNLError_wp1 = 0;
S3V3S_A_Ripple_wp1 = 10e-3;
PSRR_wp1 = 57;
ResolutionADC_wp1 = 12;
R1508_wp1 = 1e3;
R1511_wp1 = 1e3;
ADC2ADC_GainError_wp1 = 0;
ADC2ADC_OffsetError_wp1 = 0;
ADC2ADC_Isolation_wp1 = 0;
%% Combine working points into a vector
WP1 = [T_NTC_wp1 NTC_R_wp1 NTC_B2585_wp1 R1509_wp1 R1510_wp1 R1507_wp1 S3V3S_A_wp1 Ron_wp1 …
LeakageCurrent_wp1 GainError_wp1 OffsetError_wp1 VOLT_REF_3V_wp1 INLError_wp1 …
DNLError_wp1 S3V3S_A_Ripple_wp1 PSRR_wp1 ResolutionADC_wp1 R1508_wp1 R1511_wp1 …
ADC2ADC_GainError_wp1 ADC2ADC_OffsetError_wp1 ADC2ADC_Isolation_wp1];
%% Calculate sensitivity
symbols = [T_NTC NTC_R NTC_B2585 R1509 R1510 R1507 S3V3S_A Ron LeakageCurrent GainError OffsetError …
VOLT_REF_3V INLError DNLError S3V3S_A_Ripple PSRR ResolutionADC R1508 R1511 ADC2ADC_GainError …
ADC2ADC_OffsetError ADC2ADC_Isolation];
S_NTC_R_wp1 = (subs(dy_dNTC_R, symbols, WP1) * NTC_R_wp1) / subs(y, symbols, WP1)
% S_NTC_R_wp1_num = double(S_NTC_R_wp1);
S_NTC_R_wp1_num = vpa(S_NTC_R_wp1); I have 22 symbolic variables, which I create different subexpressions with. Then I mathematically combine all these subexpression in one big expression according to the calculation I have to perform. I do these steps to keep some readability. However, matlab automatically creates new variables in the final expression, whereby they are named sigmas. When I then substitute numerical values into the symbolic variables, I get a complex result, which I can convert into a double precision number. However, I need to compute the derivative first and then substitute numerical values and at that point I get the error that it is not possible to convert them because symbolic variabls remains in the expression. I suppose that’s because of the new sigma variables. I tried vpa(), double(), simplify() but I do not get it solved. Does someone have an idea how I could handle that ? You can see that the derivative result is displayed with a D if you open the result and not sigma can be seen like it is displayed in the script.
syms T_NTC NTC_R NTC_B2585 R1509 R1510 R1507 S3V3S_A Ron LeakageCurrent GainError OffsetError VOLT_REF_3V INLError DNLError S3V3S_A_Ripple PSRR ResolutionADC
syms R1508 R1511 ADC2ADC_GainError ADC2ADC_OffsetError ADC2ADC_Isolation
%% Resistor network TEMP_DCB
R_NTC = NTC_R.*exp(NTC_B2585*(1./(T_NTC)-1/298.15));
Rs_TEMP_DCB = R1509 + 1./(1./R1510+1./R_NTC+1./R1507);
TEMP_DCB = S3V3S_A.*(R_NTC.*R1510./(R_NTC+R1510))./(R_NTC.*R1510./(R_NTC+R1510)+R1507) + (Rs_TEMP_DCB+Ron).*LeakageCurrent;
ADC_error_TEMP_DCB = GainError.*TEMP_DCB./VOLT_REF_3V + OffsetError + INLError + DNLError + S3V3S_A_Ripple*10.^(-PSRR/20).*2.^ResolutionADC./VOLT_REF_3V;
TEMP_DCB_ADCRawValue = round(TEMP_DCB.*2^ResolutionADC./VOLT_REF_3V + ADC_error_TEMP_DCB);
%% Resistor network 3V3S_A
Rs_VOLT_3V3S_A = R1508.*R1511./(R1508+R1511);
VOLT_3V3S_A = S3V3S_A.*R1511./(R1511+R1508) + (Rs_VOLT_3V3S_A+Ron).*LeakageCurrent;
ADC_error_3V3S_A = (GainError+ADC2ADC_GainError).*VOLT_3V3S_A./VOLT_REF_3V + OffsetError + ADC2ADC_OffsetError + ADC2ADC_Isolation + INLError + DNLError + S3V3S_A_Ripple*10.^(-PSRR/20).*2.^ResolutionADC./VOLT_REF_3V;
VOLT_3V3S_A_ADCRawValue = round(VOLT_3V3S_A.*2^ResolutionADC./VOLT_REF_3V + ADC_error_3V3S_A);
%% Ratio TEMP_DCB/VOLT_3V3S_A
y = TEMP_DCB_ADCRawValue./VOLT_3V3S_A_ADCRawValue
%% Derivatives
dy_dNTC_R = diff(y, NTC_R);
dy_dNTC_B2585 = diff(y, NTC_B2585);
dy_dR1509 = diff(y, R1509);
dy_dR1510 = diff(y, R1510);
dy_dR1507 = diff(y, R1507);
dy_dS3V3S_A = diff(y, S3V3S_A);
dy_dRon = diff(y, Ron);
dy_dLeakageCurrent = diff(y, LeakageCurrent);
dy_dGainError = diff(y, GainError);
dy_dVOLT_REF_3V = diff(y, VOLT_REF_3V);
dy_dOffsetError = diff(y, OffsetError);
dy_dINLError = diff(y, INLError);
dy_dDNLError = diff(y, DNLError);
dy_dS3V3S_A_Ripple = diff(y, S3V3S_A_Ripple);
dy_dPSRR = diff(y, PSRR);
dy_dResolutionADC = diff(y, ResolutionADC);
dy_dR1508 = diff(y, R1508);
dy_dR1511 = diff(y, R1511);
dy_dADC2ADC_GainError = diff(y, ADC2ADC_GainError);
dy_dADC2ADC_OffsetError = diff(y, ADC2ADC_OffsetError);
dy_dADC2ADC_Isolation = diff(y, ADC2ADC_Isolation);
%% Define working points
% Define your working point values
T_NTC_wp1 = 130 + 273.15;
NTC_R_wp1 = 5e3;
NTC_B2585_wp1 = 3420;
R1509_wp1 = 1e3;
R1510_wp1 = 20e3;
R1507_wp1 = 2e3;
S3V3S_A_wp1 = 3.33;
Ron_wp1 = 500;
LeakageCurrent_wp1 = 0;
GainError_wp1 = 0;
OffsetError_wp1 = 0;
VOLT_REF_3V_wp1 = 3;
INLError_wp1 = 0;
DNLError_wp1 = 0;
S3V3S_A_Ripple_wp1 = 10e-3;
PSRR_wp1 = 57;
ResolutionADC_wp1 = 12;
R1508_wp1 = 1e3;
R1511_wp1 = 1e3;
ADC2ADC_GainError_wp1 = 0;
ADC2ADC_OffsetError_wp1 = 0;
ADC2ADC_Isolation_wp1 = 0;
%% Combine working points into a vector
WP1 = [T_NTC_wp1 NTC_R_wp1 NTC_B2585_wp1 R1509_wp1 R1510_wp1 R1507_wp1 S3V3S_A_wp1 Ron_wp1 …
LeakageCurrent_wp1 GainError_wp1 OffsetError_wp1 VOLT_REF_3V_wp1 INLError_wp1 …
DNLError_wp1 S3V3S_A_Ripple_wp1 PSRR_wp1 ResolutionADC_wp1 R1508_wp1 R1511_wp1 …
ADC2ADC_GainError_wp1 ADC2ADC_OffsetError_wp1 ADC2ADC_Isolation_wp1];
%% Calculate sensitivity
symbols = [T_NTC NTC_R NTC_B2585 R1509 R1510 R1507 S3V3S_A Ron LeakageCurrent GainError OffsetError …
VOLT_REF_3V INLError DNLError S3V3S_A_Ripple PSRR ResolutionADC R1508 R1511 ADC2ADC_GainError …
ADC2ADC_OffsetError ADC2ADC_Isolation];
S_NTC_R_wp1 = (subs(dy_dNTC_R, symbols, WP1) * NTC_R_wp1) / subs(y, symbols, WP1)
% S_NTC_R_wp1_num = double(S_NTC_R_wp1);
S_NTC_R_wp1_num = vpa(S_NTC_R_wp1); symbolic, matlab, convert, function, variables MATLAB Answers — New Questions
Simulating a high performance, very compact optical distance measurement sensors for applications such as ADAS
I was reading on innovative techniques to help implement a Vehicle-to-Pedestrian system when I came across this article "https://ieeexplore.ieee.org/document/7131685". Upon reeading, I intend to start with the MATLAB simulation. Does mathworks provide such a functionality of simulating a ladar that is edge emitting, and having 905nm, single stripe laser technology? I look forward to hearing from you.I was reading on innovative techniques to help implement a Vehicle-to-Pedestrian system when I came across this article "https://ieeexplore.ieee.org/document/7131685". Upon reeading, I intend to start with the MATLAB simulation. Does mathworks provide such a functionality of simulating a ladar that is edge emitting, and having 905nm, single stripe laser technology? I look forward to hearing from you. I was reading on innovative techniques to help implement a Vehicle-to-Pedestrian system when I came across this article "https://ieeexplore.ieee.org/document/7131685". Upon reeading, I intend to start with the MATLAB simulation. Does mathworks provide such a functionality of simulating a ladar that is edge emitting, and having 905nm, single stripe laser technology? I look forward to hearing from you. lidar, sensor, its, v2x MATLAB Answers — New Questions
Why are the lines not showing up on my graph?
I need to show two separate lines on the same figure, one for dcs and one for d2p, using the values provided by each iteration of the for loop. I’m not sure what I’m doing wrong here. Thanks in advance! Here is my code:
N = [10 90 1000]; % number of peers
F = 20 * 1024; % converting Gbits to Mbits
us = 30; % server upload
di = 2; % client download
u = 300/1024; % client upload
dcs = zeros(size(N));
dp2 = zeros(size(N));
figure();
grid
hold on;
for i = 1:1:length(N)
Nval = N(i);
cs1 = Nval*F/us;
cs2 = F/di;
dcs = max(cs1,cs2);
p21 = F/us;
ui = u*Nval;
p23 = Nval*F/(us+ui);
dp2 = max([p21(:); cs2(:); p23(:)]);
plot(dcs, Nval);
plot(dp2, Nval);
title(‘Distribution Time’)
end
ylabel(‘Minimum Distribution Time’)
xlabel(‘N’)I need to show two separate lines on the same figure, one for dcs and one for d2p, using the values provided by each iteration of the for loop. I’m not sure what I’m doing wrong here. Thanks in advance! Here is my code:
N = [10 90 1000]; % number of peers
F = 20 * 1024; % converting Gbits to Mbits
us = 30; % server upload
di = 2; % client download
u = 300/1024; % client upload
dcs = zeros(size(N));
dp2 = zeros(size(N));
figure();
grid
hold on;
for i = 1:1:length(N)
Nval = N(i);
cs1 = Nval*F/us;
cs2 = F/di;
dcs = max(cs1,cs2);
p21 = F/us;
ui = u*Nval;
p23 = Nval*F/(us+ui);
dp2 = max([p21(:); cs2(:); p23(:)]);
plot(dcs, Nval);
plot(dp2, Nval);
title(‘Distribution Time’)
end
ylabel(‘Minimum Distribution Time’)
xlabel(‘N’) I need to show two separate lines on the same figure, one for dcs and one for d2p, using the values provided by each iteration of the for loop. I’m not sure what I’m doing wrong here. Thanks in advance! Here is my code:
N = [10 90 1000]; % number of peers
F = 20 * 1024; % converting Gbits to Mbits
us = 30; % server upload
di = 2; % client download
u = 300/1024; % client upload
dcs = zeros(size(N));
dp2 = zeros(size(N));
figure();
grid
hold on;
for i = 1:1:length(N)
Nval = N(i);
cs1 = Nval*F/us;
cs2 = F/di;
dcs = max(cs1,cs2);
p21 = F/us;
ui = u*Nval;
p23 = Nval*F/(us+ui);
dp2 = max([p21(:); cs2(:); p23(:)]);
plot(dcs, Nval);
plot(dp2, Nval);
title(‘Distribution Time’)
end
ylabel(‘Minimum Distribution Time’)
xlabel(‘N’) graph, for loop, max MATLAB Answers — New Questions
Can I use production server to create ctf file and do I need to install matlab compiler sdk along with production server to achieve this?
I wrote a matlab script which contains command ‘mcc’ and the options to create the ctf in my local machine. The script runs correctly with the ctf created. However, when I deployed the codes on the production server, the command mcc cannot be executed. My local computer has both matlab compiler and matlab compiler sdk installed. It looks like the production server has matlab runtime running, maybe matlab compiler. But definitely no matlab compiler sdk. So should I install matlab compiler sdk on the same server as the production server? After installation, how do I tell the production server where to find the matlab compiler sdk and the command of "mcc"?I wrote a matlab script which contains command ‘mcc’ and the options to create the ctf in my local machine. The script runs correctly with the ctf created. However, when I deployed the codes on the production server, the command mcc cannot be executed. My local computer has both matlab compiler and matlab compiler sdk installed. It looks like the production server has matlab runtime running, maybe matlab compiler. But definitely no matlab compiler sdk. So should I install matlab compiler sdk on the same server as the production server? After installation, how do I tell the production server where to find the matlab compiler sdk and the command of "mcc"? I wrote a matlab script which contains command ‘mcc’ and the options to create the ctf in my local machine. The script runs correctly with the ctf created. However, when I deployed the codes on the production server, the command mcc cannot be executed. My local computer has both matlab compiler and matlab compiler sdk installed. It looks like the production server has matlab runtime running, maybe matlab compiler. But definitely no matlab compiler sdk. So should I install matlab compiler sdk on the same server as the production server? After installation, how do I tell the production server where to find the matlab compiler sdk and the command of "mcc"? production server, ctf file, mcc command, matlab compiler sdk, matlab compiler, path to mcc MATLAB Answers — New Questions
GPU utilization is not 100%.
The GPU usage is only 40% allocated for running the deep learning network.
Sometimes go up to 80% for a while but usually stay at 40%.
I want to know why.The GPU usage is only 40% allocated for running the deep learning network.
Sometimes go up to 80% for a while but usually stay at 40%.
I want to know why. The GPU usage is only 40% allocated for running the deep learning network.
Sometimes go up to 80% for a while but usually stay at 40%.
I want to know why. deep learning, gpu, trainnetwork MATLAB Answers — New Questions
Abnormal trailing ^ on input
I have suddenly run into a strange problem. Now, when pressing ^, my command line (not the editor) enters an abnormal state, writing ^ (underscored) AFTER the last of any subsequent input characters. The trailing ^ only disappears after pressing Enter (without its usual effect). The problem prevails after exiting and reopening matlab, and even after restarting the computer. Any solution or hint?I have suddenly run into a strange problem. Now, when pressing ^, my command line (not the editor) enters an abnormal state, writing ^ (underscored) AFTER the last of any subsequent input characters. The trailing ^ only disappears after pressing Enter (without its usual effect). The problem prevails after exiting and reopening matlab, and even after restarting the computer. Any solution or hint? I have suddenly run into a strange problem. Now, when pressing ^, my command line (not the editor) enters an abnormal state, writing ^ (underscored) AFTER the last of any subsequent input characters. The trailing ^ only disappears after pressing Enter (without its usual effect). The problem prevails after exiting and reopening matlab, and even after restarting the computer. Any solution or hint? abnormal ^ MATLAB Answers — New Questions
How to propagate orbits on a non-rotating axesm globe
I used as my foundation the example found here:
https://www.mathworks.com/help/map/plotting-a-3-d-dome-as-a-mesh-over-a-globe.html
As described, I plotted a radar dome on a axesm globe.
Now I want to display satellite orbits. For that, I used the orbital propagation model found here:
https://www.mathworks.com/help/satcom/ug/comparison-of-orbit-propagators.html
This model uses a TLE file to generate a set of ephemeris tables containing XYZ coordinates for a satellite at 60-second intervals.
[positionSGP4,velocitySGP4] = states(satSGP4);
positionSGP4 = 3×2881
10^7 x
-2.5292 -2.5313 -2.5334 -2.5353 -2.5373 …
0.6924 0.6848 0.6772 0.6695 0.6619
3.1681 3.1583 3.1484 3.1384 3.1284
I took this XYZ coordinate data and rotated it sideways, and added a time column to create an ephemeris table. I converted it to latitude and longitude, then I used it to plot satellite coordinates on my axesm earth globe.
What I found was that the satSGP4 orbit propagator model has a built-in rotating Earth model, while my axesm Earth model does not. A precessing, Sun-synchronous polar orbit works its way around the satSGP4 model every 24 hours, while with my axesm Earth model, it just keeps retracing the same path in longitude. Mind you, there is nothing in the positionSGP4 data to account for orbital precession. Something else is making it happen.
I tried biasing the longitude values based on time and got a reasonable-looking, precessing plot, but it is still out of phase with the SGP4 propagator model.
Question: is there something built into the propagator model that takes into account Earth’s siderial rotation? How do I apply that to my non-rotating Earth model?
I don’t want to go down the Satellite Communications Toolkit approach. I already have a working radar system, up to this point.I used as my foundation the example found here:
https://www.mathworks.com/help/map/plotting-a-3-d-dome-as-a-mesh-over-a-globe.html
As described, I plotted a radar dome on a axesm globe.
Now I want to display satellite orbits. For that, I used the orbital propagation model found here:
https://www.mathworks.com/help/satcom/ug/comparison-of-orbit-propagators.html
This model uses a TLE file to generate a set of ephemeris tables containing XYZ coordinates for a satellite at 60-second intervals.
[positionSGP4,velocitySGP4] = states(satSGP4);
positionSGP4 = 3×2881
10^7 x
-2.5292 -2.5313 -2.5334 -2.5353 -2.5373 …
0.6924 0.6848 0.6772 0.6695 0.6619
3.1681 3.1583 3.1484 3.1384 3.1284
I took this XYZ coordinate data and rotated it sideways, and added a time column to create an ephemeris table. I converted it to latitude and longitude, then I used it to plot satellite coordinates on my axesm earth globe.
What I found was that the satSGP4 orbit propagator model has a built-in rotating Earth model, while my axesm Earth model does not. A precessing, Sun-synchronous polar orbit works its way around the satSGP4 model every 24 hours, while with my axesm Earth model, it just keeps retracing the same path in longitude. Mind you, there is nothing in the positionSGP4 data to account for orbital precession. Something else is making it happen.
I tried biasing the longitude values based on time and got a reasonable-looking, precessing plot, but it is still out of phase with the SGP4 propagator model.
Question: is there something built into the propagator model that takes into account Earth’s siderial rotation? How do I apply that to my non-rotating Earth model?
I don’t want to go down the Satellite Communications Toolkit approach. I already have a working radar system, up to this point. I used as my foundation the example found here:
https://www.mathworks.com/help/map/plotting-a-3-d-dome-as-a-mesh-over-a-globe.html
As described, I plotted a radar dome on a axesm globe.
Now I want to display satellite orbits. For that, I used the orbital propagation model found here:
https://www.mathworks.com/help/satcom/ug/comparison-of-orbit-propagators.html
This model uses a TLE file to generate a set of ephemeris tables containing XYZ coordinates for a satellite at 60-second intervals.
[positionSGP4,velocitySGP4] = states(satSGP4);
positionSGP4 = 3×2881
10^7 x
-2.5292 -2.5313 -2.5334 -2.5353 -2.5373 …
0.6924 0.6848 0.6772 0.6695 0.6619
3.1681 3.1583 3.1484 3.1384 3.1284
I took this XYZ coordinate data and rotated it sideways, and added a time column to create an ephemeris table. I converted it to latitude and longitude, then I used it to plot satellite coordinates on my axesm earth globe.
What I found was that the satSGP4 orbit propagator model has a built-in rotating Earth model, while my axesm Earth model does not. A precessing, Sun-synchronous polar orbit works its way around the satSGP4 model every 24 hours, while with my axesm Earth model, it just keeps retracing the same path in longitude. Mind you, there is nothing in the positionSGP4 data to account for orbital precession. Something else is making it happen.
I tried biasing the longitude values based on time and got a reasonable-looking, precessing plot, but it is still out of phase with the SGP4 propagator model.
Question: is there something built into the propagator model that takes into account Earth’s siderial rotation? How do I apply that to my non-rotating Earth model?
I don’t want to go down the Satellite Communications Toolkit approach. I already have a working radar system, up to this point. orbit propagation, sgp4, rotating earth MATLAB Answers — New Questions
Connection to a database
I have a script in which data from an ORACLE database are called. The problem is that the connection isn’t always succesfull. After 3-4 attempts the connection is succesfull. Do you know why does ths happen?
ThanksI have a script in which data from an ORACLE database are called. The problem is that the connection isn’t always succesfull. After 3-4 attempts the connection is succesfull. Do you know why does ths happen?
Thanks I have a script in which data from an ORACLE database are called. The problem is that the connection isn’t always succesfull. After 3-4 attempts the connection is succesfull. Do you know why does ths happen?
Thanks database, oracle, query MATLAB Answers — New Questions
Image Acquisition Toolbox Support Package for GenICam Interface does not install
Hi all,
i tried to install Image Acquisition Toolbox Support Package for GenICam Interface and it told me it is already installed but it does not appear in the addon manager and is not available.
how can i fix this?
thanks a lot for any help
kind regards
Norbert
PS i use 2024a unfortunately i cannot set the version in the menueHi all,
i tried to install Image Acquisition Toolbox Support Package for GenICam Interface and it told me it is already installed but it does not appear in the addon manager and is not available.
how can i fix this?
thanks a lot for any help
kind regards
Norbert
PS i use 2024a unfortunately i cannot set the version in the menue Hi all,
i tried to install Image Acquisition Toolbox Support Package for GenICam Interface and it told me it is already installed but it does not appear in the addon manager and is not available.
how can i fix this?
thanks a lot for any help
kind regards
Norbert
PS i use 2024a unfortunately i cannot set the version in the menue image acquisition MATLAB Answers — New Questions
Mouse Pointer Stuck in Editor on macOS 13.7 with MATLAB R2024a ARM Version
I am experiencing an issue with the mouse pointer in the MATLAB editor on my macOS 13.7 system (MATLAB R2024a arm version). Specifically, after right-clicking in the editor window, the pointer sometimes becomes stuck in the cursor form and does not revert to the text-editing cursor. This issue also occurs in other instances when focusing back on the MATLAB’s editor window, where the pointer occasionally fails to switch to the text-editing shape. And if I install R2020b (or earlier versions?), the issue does not occur.
Here is a GIF animation of the bug, which includes the following processes:
Sometimes when focusing on the editor, the cursor does not change to the text-editing cursor.
After changing the cursor in another area and moving it back to the editor, the text cursor displays normally.
When the cursor enters the right-click menu and then returns to the editor, there is a chance that it will not switch back to the text-editing cursor.
I have tried several troubleshooting steps, including:
Removing or disabling third-party utility applications that require accessibility permissions.
Rebooting the system after disabling all accessibility plugins or rebooting in safe mode.
I even tried reinstalling macOS and have a fresh install of Matlab R2024a without other programs installed. (BTW, it seems that macOS versions >= Sonoma have a even worth, and reported system-wide mouse cursor bug, and it hasn’t been resolved even up to Sequoia. Since I just downgraded from Sonoma)
Unfortunately, these attempts did not resolve the issue. I am really curious whether this is an issue with MATLAB or with the operating system. Although I have already tried reinstalling the system and can reproduce the issue, I am not sure if this problem can be reproduced on other Mac. This may not be a serious issue, but it’s annoying. Do you have any suggestions for resolving the problem? Thank you for your help.I am experiencing an issue with the mouse pointer in the MATLAB editor on my macOS 13.7 system (MATLAB R2024a arm version). Specifically, after right-clicking in the editor window, the pointer sometimes becomes stuck in the cursor form and does not revert to the text-editing cursor. This issue also occurs in other instances when focusing back on the MATLAB’s editor window, where the pointer occasionally fails to switch to the text-editing shape. And if I install R2020b (or earlier versions?), the issue does not occur.
Here is a GIF animation of the bug, which includes the following processes:
Sometimes when focusing on the editor, the cursor does not change to the text-editing cursor.
After changing the cursor in another area and moving it back to the editor, the text cursor displays normally.
When the cursor enters the right-click menu and then returns to the editor, there is a chance that it will not switch back to the text-editing cursor.
I have tried several troubleshooting steps, including:
Removing or disabling third-party utility applications that require accessibility permissions.
Rebooting the system after disabling all accessibility plugins or rebooting in safe mode.
I even tried reinstalling macOS and have a fresh install of Matlab R2024a without other programs installed. (BTW, it seems that macOS versions >= Sonoma have a even worth, and reported system-wide mouse cursor bug, and it hasn’t been resolved even up to Sequoia. Since I just downgraded from Sonoma)
Unfortunately, these attempts did not resolve the issue. I am really curious whether this is an issue with MATLAB or with the operating system. Although I have already tried reinstalling the system and can reproduce the issue, I am not sure if this problem can be reproduced on other Mac. This may not be a serious issue, but it’s annoying. Do you have any suggestions for resolving the problem? Thank you for your help. I am experiencing an issue with the mouse pointer in the MATLAB editor on my macOS 13.7 system (MATLAB R2024a arm version). Specifically, after right-clicking in the editor window, the pointer sometimes becomes stuck in the cursor form and does not revert to the text-editing cursor. This issue also occurs in other instances when focusing back on the MATLAB’s editor window, where the pointer occasionally fails to switch to the text-editing shape. And if I install R2020b (or earlier versions?), the issue does not occur.
Here is a GIF animation of the bug, which includes the following processes:
Sometimes when focusing on the editor, the cursor does not change to the text-editing cursor.
After changing the cursor in another area and moving it back to the editor, the text cursor displays normally.
When the cursor enters the right-click menu and then returns to the editor, there is a chance that it will not switch back to the text-editing cursor.
I have tried several troubleshooting steps, including:
Removing or disabling third-party utility applications that require accessibility permissions.
Rebooting the system after disabling all accessibility plugins or rebooting in safe mode.
I even tried reinstalling macOS and have a fresh install of Matlab R2024a without other programs installed. (BTW, it seems that macOS versions >= Sonoma have a even worth, and reported system-wide mouse cursor bug, and it hasn’t been resolved even up to Sequoia. Since I just downgraded from Sonoma)
Unfortunately, these attempts did not resolve the issue. I am really curious whether this is an issue with MATLAB or with the operating system. Although I have already tried reinstalling the system and can reproduce the issue, I am not sure if this problem can be reproduced on other Mac. This may not be a serious issue, but it’s annoying. Do you have any suggestions for resolving the problem? Thank you for your help. mouse, cursor, matlab gui MATLAB Answers — New Questions
Error in Scenario Server: WorldRunTimeLogging logging has not been enabled
rrSim = rrApp.createSimulation
rrSim.set("Logging","on")
rrSim.set("SimulationCommand","Start")
rrLog = rrSim.get("SimulationLog");
I ran the above lines of code, trying to get the log of Roadrunner simulation. However, after enabling logging through rrSim and waiting for the simulation to complete, I can’t run rrSim.get("SimulationLog"), due to this error:
Error using Simulink.ScenarioSimulationMcos/get
Error in Scenario Server: WorldRuntimeLogging logging has not been enabled.
Error in Simulink.ScenarioSimulation/get
Any help is appreciatedrrSim = rrApp.createSimulation
rrSim.set("Logging","on")
rrSim.set("SimulationCommand","Start")
rrLog = rrSim.get("SimulationLog");
I ran the above lines of code, trying to get the log of Roadrunner simulation. However, after enabling logging through rrSim and waiting for the simulation to complete, I can’t run rrSim.get("SimulationLog"), due to this error:
Error using Simulink.ScenarioSimulationMcos/get
Error in Scenario Server: WorldRuntimeLogging logging has not been enabled.
Error in Simulink.ScenarioSimulation/get
Any help is appreciated rrSim = rrApp.createSimulation
rrSim.set("Logging","on")
rrSim.set("SimulationCommand","Start")
rrLog = rrSim.get("SimulationLog");
I ran the above lines of code, trying to get the log of Roadrunner simulation. However, after enabling logging through rrSim and waiting for the simulation to complete, I can’t run rrSim.get("SimulationLog"), due to this error:
Error using Simulink.ScenarioSimulationMcos/get
Error in Scenario Server: WorldRuntimeLogging logging has not been enabled.
Error in Simulink.ScenarioSimulation/get
Any help is appreciated roadrunner, matlab, scenariosimulation MATLAB Answers — New Questions
unable to modify a simulink block
In matlab there exist a block called "LPV system". It’s a mask and into it there are several other blocks (figure below). Now i need to add/remove some of these sub-blocks and modify it. I’m able to do it (there are no errors), but when i run the simulation every change i do is canceled and it works like i did nothing. How can i modify it? Thank you in advanceIn matlab there exist a block called "LPV system". It’s a mask and into it there are several other blocks (figure below). Now i need to add/remove some of these sub-blocks and modify it. I’m able to do it (there are no errors), but when i run the simulation every change i do is canceled and it works like i did nothing. How can i modify it? Thank you in advance In matlab there exist a block called "LPV system". It’s a mask and into it there are several other blocks (figure below). Now i need to add/remove some of these sub-blocks and modify it. I’m able to do it (there are no errors), but when i run the simulation every change i do is canceled and it works like i did nothing. How can i modify it? Thank you in advance simulink block, libreries, simulink, modify block MATLAB Answers — New Questions
Unable to run Simulink due to .dll error after installing 2016b
I have 2019b on my machine and all works fine. I have now installed 2016b on same machine. When I try to run Simulink in 2016b. matlab will open and Simulink will attempt to intialize but fails with an error dialog indicating "Can’t load ‘C:Program FilesMATLABR2016bbinwin64libmwsimulink.dll’: The specified procedure could not be found."
I can find this .dll in the specified folder, and it has a size of ~36MB. What can be cauing this error?I have 2019b on my machine and all works fine. I have now installed 2016b on same machine. When I try to run Simulink in 2016b. matlab will open and Simulink will attempt to intialize but fails with an error dialog indicating "Can’t load ‘C:Program FilesMATLABR2016bbinwin64libmwsimulink.dll’: The specified procedure could not be found."
I can find this .dll in the specified folder, and it has a size of ~36MB. What can be cauing this error? I have 2019b on my machine and all works fine. I have now installed 2016b on same machine. When I try to run Simulink in 2016b. matlab will open and Simulink will attempt to intialize but fails with an error dialog indicating "Can’t load ‘C:Program FilesMATLABR2016bbinwin64libmwsimulink.dll’: The specified procedure could not be found."
I can find this .dll in the specified folder, and it has a size of ~36MB. What can be cauing this error? dll error MATLAB Answers — New Questions
Changing the value of only one parameter causes a problem (possibly with while loop)
Hello everyone. Firstly, as I do not have access to my other computer right now, I am using the online compiler, if that makes any difference (but I do not think so). In the attaced code, in the first section, when I set the d(1:10) value to 0.04, it just can’t proceed further after the while loop and keeps calculating forever, as seen in screenshot (1). At least I assume so; the thing is, I haven’t used matlab much and when I open the debugger (screenshot(2)) and step in and continue, it keeps doing the while loop over and over again. Overall, I do not get any crucial error that seemingly affect the working mechanism of the code: Only "consider preallocating for speed suggestions", so I cannot understand what is wrong with it. By the way, this happens as the value gets smaller: When d is smaller than 0.07. When I set it to something like 150, it still works. What might be the reasoon?
Thanks in advance!
%% Constants and Assumptions
g=9.81;
hgelgit=0.5;
he=0.3;
Vmin=0.6;
Vmax=0.9;
f=0.03;
s=0.25;
Cq(1)=0.61;
rho0=1008.301;
rhoa=998.83;
H=20;
Lana=1500;
d(1:10)=0.04;
hf(1)=0;
%% Initial Hydraulic Head
h=(rhoa*(H+hgelgit+he))/(rho0);
E(1)=h-H;
%% First Port
a(1)=pi*(d(1))^2./4;
q(1)=Cq(1)*a(1)*sqrt(2*g*E(1));
Q(1)=q(1);
D(1)=floor(20*(sqrt(4*Q(1)/(pi*Vmin))))/20;
A(1)=pi*D(1)^2./4;
V(1)=Q(1)/(pi*(D(1)^2./4)); %[m/s]
hizyuk(1)=0;
U(1)=q(1)/(pi*d(1)^2./4);
Dmax(1)=(sqrt(4*Q(1)/(pi*Vmin)));
Dmin(1)=(sqrt(4*Q(1)/(pi*Vmax)));
%% Other Ports
for i=2:10
hf(i)=f*(s/D(i-1))*(V(i-1)^2./(2*g));
E(i)=E(i-1)+hf(i);
Cq(i)=0.63-0.58*(((V(i-1))^2)/(2*g*E(i)));
a(i)=pi*(d(i))^2./4;
x=cumsum(a);
q(i)=Cq(i)*a(i)*sqrt(2*g*E(i));
Q(i)=Q(i-1)+q(i);
Dmax(i)=(sqrt(4*Q(i)/(pi*Vmin)));
Dmin(i)=(sqrt(4*Q(i)/(pi*Vmax)));
D(i)=D(i-1);
A(i)=pi*D(i)^2./4;
V(i)=Q(i)/(pi*(D(i)^2./4));
hizyuk(i)=V(i-1)^2./(2*g*E(i));
while (V(i) >= Vmax)
D(i)=floor(20*(sqrt(4*Q(i)/(pi*Vmin))))/20;
V(i)=Q(i)/(pi*(D(i)^2./4));
end
U(i)=q(i)/(pi*d(i)^2./4);
end
y=x./(pi*D.^2./4);
%% Results
results=zeros(10,16);
results(:,1)=transpose(hf);
results(:,2)=transpose(E);
results(:,3)=transpose(hizyuk);
results(:,4)=transpose(Cq);
results(:,5)=transpose(a);
results(:,6)=transpose(x);
results(:,7)=transpose(q);
results(:,8)=transpose(U);
results(:,9)=transpose(Q);
results(:,10)=transpose(Dmin);
results(:,11)=transpose(Dmax);
results(:,12)=transpose(D);
results(:,13)=transpose(A);
results(:,14)=transpose(y);
results(:,15)=transpose(V);
results(:,16)=transpose(Q)*1000;
max(q)/min(q)
resultsHello everyone. Firstly, as I do not have access to my other computer right now, I am using the online compiler, if that makes any difference (but I do not think so). In the attaced code, in the first section, when I set the d(1:10) value to 0.04, it just can’t proceed further after the while loop and keeps calculating forever, as seen in screenshot (1). At least I assume so; the thing is, I haven’t used matlab much and when I open the debugger (screenshot(2)) and step in and continue, it keeps doing the while loop over and over again. Overall, I do not get any crucial error that seemingly affect the working mechanism of the code: Only "consider preallocating for speed suggestions", so I cannot understand what is wrong with it. By the way, this happens as the value gets smaller: When d is smaller than 0.07. When I set it to something like 150, it still works. What might be the reasoon?
Thanks in advance!
%% Constants and Assumptions
g=9.81;
hgelgit=0.5;
he=0.3;
Vmin=0.6;
Vmax=0.9;
f=0.03;
s=0.25;
Cq(1)=0.61;
rho0=1008.301;
rhoa=998.83;
H=20;
Lana=1500;
d(1:10)=0.04;
hf(1)=0;
%% Initial Hydraulic Head
h=(rhoa*(H+hgelgit+he))/(rho0);
E(1)=h-H;
%% First Port
a(1)=pi*(d(1))^2./4;
q(1)=Cq(1)*a(1)*sqrt(2*g*E(1));
Q(1)=q(1);
D(1)=floor(20*(sqrt(4*Q(1)/(pi*Vmin))))/20;
A(1)=pi*D(1)^2./4;
V(1)=Q(1)/(pi*(D(1)^2./4)); %[m/s]
hizyuk(1)=0;
U(1)=q(1)/(pi*d(1)^2./4);
Dmax(1)=(sqrt(4*Q(1)/(pi*Vmin)));
Dmin(1)=(sqrt(4*Q(1)/(pi*Vmax)));
%% Other Ports
for i=2:10
hf(i)=f*(s/D(i-1))*(V(i-1)^2./(2*g));
E(i)=E(i-1)+hf(i);
Cq(i)=0.63-0.58*(((V(i-1))^2)/(2*g*E(i)));
a(i)=pi*(d(i))^2./4;
x=cumsum(a);
q(i)=Cq(i)*a(i)*sqrt(2*g*E(i));
Q(i)=Q(i-1)+q(i);
Dmax(i)=(sqrt(4*Q(i)/(pi*Vmin)));
Dmin(i)=(sqrt(4*Q(i)/(pi*Vmax)));
D(i)=D(i-1);
A(i)=pi*D(i)^2./4;
V(i)=Q(i)/(pi*(D(i)^2./4));
hizyuk(i)=V(i-1)^2./(2*g*E(i));
while (V(i) >= Vmax)
D(i)=floor(20*(sqrt(4*Q(i)/(pi*Vmin))))/20;
V(i)=Q(i)/(pi*(D(i)^2./4));
end
U(i)=q(i)/(pi*d(i)^2./4);
end
y=x./(pi*D.^2./4);
%% Results
results=zeros(10,16);
results(:,1)=transpose(hf);
results(:,2)=transpose(E);
results(:,3)=transpose(hizyuk);
results(:,4)=transpose(Cq);
results(:,5)=transpose(a);
results(:,6)=transpose(x);
results(:,7)=transpose(q);
results(:,8)=transpose(U);
results(:,9)=transpose(Q);
results(:,10)=transpose(Dmin);
results(:,11)=transpose(Dmax);
results(:,12)=transpose(D);
results(:,13)=transpose(A);
results(:,14)=transpose(y);
results(:,15)=transpose(V);
results(:,16)=transpose(Q)*1000;
max(q)/min(q)
results Hello everyone. Firstly, as I do not have access to my other computer right now, I am using the online compiler, if that makes any difference (but I do not think so). In the attaced code, in the first section, when I set the d(1:10) value to 0.04, it just can’t proceed further after the while loop and keeps calculating forever, as seen in screenshot (1). At least I assume so; the thing is, I haven’t used matlab much and when I open the debugger (screenshot(2)) and step in and continue, it keeps doing the while loop over and over again. Overall, I do not get any crucial error that seemingly affect the working mechanism of the code: Only "consider preallocating for speed suggestions", so I cannot understand what is wrong with it. By the way, this happens as the value gets smaller: When d is smaller than 0.07. When I set it to something like 150, it still works. What might be the reasoon?
Thanks in advance!
%% Constants and Assumptions
g=9.81;
hgelgit=0.5;
he=0.3;
Vmin=0.6;
Vmax=0.9;
f=0.03;
s=0.25;
Cq(1)=0.61;
rho0=1008.301;
rhoa=998.83;
H=20;
Lana=1500;
d(1:10)=0.04;
hf(1)=0;
%% Initial Hydraulic Head
h=(rhoa*(H+hgelgit+he))/(rho0);
E(1)=h-H;
%% First Port
a(1)=pi*(d(1))^2./4;
q(1)=Cq(1)*a(1)*sqrt(2*g*E(1));
Q(1)=q(1);
D(1)=floor(20*(sqrt(4*Q(1)/(pi*Vmin))))/20;
A(1)=pi*D(1)^2./4;
V(1)=Q(1)/(pi*(D(1)^2./4)); %[m/s]
hizyuk(1)=0;
U(1)=q(1)/(pi*d(1)^2./4);
Dmax(1)=(sqrt(4*Q(1)/(pi*Vmin)));
Dmin(1)=(sqrt(4*Q(1)/(pi*Vmax)));
%% Other Ports
for i=2:10
hf(i)=f*(s/D(i-1))*(V(i-1)^2./(2*g));
E(i)=E(i-1)+hf(i);
Cq(i)=0.63-0.58*(((V(i-1))^2)/(2*g*E(i)));
a(i)=pi*(d(i))^2./4;
x=cumsum(a);
q(i)=Cq(i)*a(i)*sqrt(2*g*E(i));
Q(i)=Q(i-1)+q(i);
Dmax(i)=(sqrt(4*Q(i)/(pi*Vmin)));
Dmin(i)=(sqrt(4*Q(i)/(pi*Vmax)));
D(i)=D(i-1);
A(i)=pi*D(i)^2./4;
V(i)=Q(i)/(pi*(D(i)^2./4));
hizyuk(i)=V(i-1)^2./(2*g*E(i));
while (V(i) >= Vmax)
D(i)=floor(20*(sqrt(4*Q(i)/(pi*Vmin))))/20;
V(i)=Q(i)/(pi*(D(i)^2./4));
end
U(i)=q(i)/(pi*d(i)^2./4);
end
y=x./(pi*D.^2./4);
%% Results
results=zeros(10,16);
results(:,1)=transpose(hf);
results(:,2)=transpose(E);
results(:,3)=transpose(hizyuk);
results(:,4)=transpose(Cq);
results(:,5)=transpose(a);
results(:,6)=transpose(x);
results(:,7)=transpose(q);
results(:,8)=transpose(U);
results(:,9)=transpose(Q);
results(:,10)=transpose(Dmin);
results(:,11)=transpose(Dmax);
results(:,12)=transpose(D);
results(:,13)=transpose(A);
results(:,14)=transpose(y);
results(:,15)=transpose(V);
results(:,16)=transpose(Q)*1000;
max(q)/min(q)
results matlab, while loop, debugger MATLAB Answers — New Questions
YOLOv4 exportONNX Warnings
Hi, I am trying to export the YOLOv4 "tiny-yolov4-coco" network as ONNX using the exportONNX function. It is currently giving me the following warnings:
Warning: ONNX does not support layer ‘nnet.cnn.layer.FunctionLayer’. Exporting to ONNX
operator ‘com.MathWorks.Placeholder’.
Warning: ONNX does not support layer ‘nnet.cnn.layer.FunctionLayer’. Exporting to ONNX
operator ‘com.MathWorks.Placeholder’.
Warning: ONNX does not support layer ‘nnet.cnn.layer.FunctionLayer’. Exporting to ONNX
operator ‘com.MathWorks.Placeholder’.
Warning: Cannot exactly export Layer ‘up2d_35_new’ with ‘GeometricTransformMode’ set to
‘half-pixel’ for ‘OpsetVersion’ ‘8’. Exported network may produce different results.
Warning: Cannot exactly export Layer ‘up2d_35_new’ with ‘NearestRoundingMode’ set to ’round’
for ‘OpsetVersion’ ‘8’. Exported network may produce different results.
I realise that the functions here are just not supported yet on exportONNX based on the documentation. Are there alternatives to the above functions? Also, are there applications that can edit these placeholder values as ONNX files?Hi, I am trying to export the YOLOv4 "tiny-yolov4-coco" network as ONNX using the exportONNX function. It is currently giving me the following warnings:
Warning: ONNX does not support layer ‘nnet.cnn.layer.FunctionLayer’. Exporting to ONNX
operator ‘com.MathWorks.Placeholder’.
Warning: ONNX does not support layer ‘nnet.cnn.layer.FunctionLayer’. Exporting to ONNX
operator ‘com.MathWorks.Placeholder’.
Warning: ONNX does not support layer ‘nnet.cnn.layer.FunctionLayer’. Exporting to ONNX
operator ‘com.MathWorks.Placeholder’.
Warning: Cannot exactly export Layer ‘up2d_35_new’ with ‘GeometricTransformMode’ set to
‘half-pixel’ for ‘OpsetVersion’ ‘8’. Exported network may produce different results.
Warning: Cannot exactly export Layer ‘up2d_35_new’ with ‘NearestRoundingMode’ set to ’round’
for ‘OpsetVersion’ ‘8’. Exported network may produce different results.
I realise that the functions here are just not supported yet on exportONNX based on the documentation. Are there alternatives to the above functions? Also, are there applications that can edit these placeholder values as ONNX files? Hi, I am trying to export the YOLOv4 "tiny-yolov4-coco" network as ONNX using the exportONNX function. It is currently giving me the following warnings:
Warning: ONNX does not support layer ‘nnet.cnn.layer.FunctionLayer’. Exporting to ONNX
operator ‘com.MathWorks.Placeholder’.
Warning: ONNX does not support layer ‘nnet.cnn.layer.FunctionLayer’. Exporting to ONNX
operator ‘com.MathWorks.Placeholder’.
Warning: ONNX does not support layer ‘nnet.cnn.layer.FunctionLayer’. Exporting to ONNX
operator ‘com.MathWorks.Placeholder’.
Warning: Cannot exactly export Layer ‘up2d_35_new’ with ‘GeometricTransformMode’ set to
‘half-pixel’ for ‘OpsetVersion’ ‘8’. Exported network may produce different results.
Warning: Cannot exactly export Layer ‘up2d_35_new’ with ‘NearestRoundingMode’ set to ’round’
for ‘OpsetVersion’ ‘8’. Exported network may produce different results.
I realise that the functions here are just not supported yet on exportONNX based on the documentation. Are there alternatives to the above functions? Also, are there applications that can edit these placeholder values as ONNX files? onnx, yolov4 MATLAB Answers — New Questions
how to control landsman converter’s inrush current using model predictive control
i want to control the inrush current in load side at dynamic conditionsi want to control the inrush current in load side at dynamic conditions i want to control the inrush current in load side at dynamic conditions power_electronics_control MATLAB Answers — New Questions
Optimize code without for loop
My code uses 6 nested for loops, it is basically used to build 3D matrix with data in specific order from 2D matrix with data in random order.
These lines work as expected but take significant times to execute.
Is there any alternative approach of programming which lead to avoid all these for loops and therefore speed up the execution ?
for z=1:1001
p=0;
for j=1:length(DOFNameRef)
for n=1:length(DOFDir)
for i=1:length(DOFNamePoint)
for l=1:length(DOFDir)
p = p+1;
for k=1:Mlig*Mcol
c(k) = contains(Resp(k),DOFNamePoint(i)) && contains(Resp(k),DOFDir(l)) && contains(Ref(k), DOFNameRef(j)) && contains(Ref(k),DOFDir(n));
end
[NumLigne, NumCol] = NLignNCol(p,Mlig, Mcol);
M(NumLigne,NumCol,z) = Data(z, c);
end
end
end
end
endMy code uses 6 nested for loops, it is basically used to build 3D matrix with data in specific order from 2D matrix with data in random order.
These lines work as expected but take significant times to execute.
Is there any alternative approach of programming which lead to avoid all these for loops and therefore speed up the execution ?
for z=1:1001
p=0;
for j=1:length(DOFNameRef)
for n=1:length(DOFDir)
for i=1:length(DOFNamePoint)
for l=1:length(DOFDir)
p = p+1;
for k=1:Mlig*Mcol
c(k) = contains(Resp(k),DOFNamePoint(i)) && contains(Resp(k),DOFDir(l)) && contains(Ref(k), DOFNameRef(j)) && contains(Ref(k),DOFDir(n));
end
[NumLigne, NumCol] = NLignNCol(p,Mlig, Mcol);
M(NumLigne,NumCol,z) = Data(z, c);
end
end
end
end
end My code uses 6 nested for loops, it is basically used to build 3D matrix with data in specific order from 2D matrix with data in random order.
These lines work as expected but take significant times to execute.
Is there any alternative approach of programming which lead to avoid all these for loops and therefore speed up the execution ?
for z=1:1001
p=0;
for j=1:length(DOFNameRef)
for n=1:length(DOFDir)
for i=1:length(DOFNamePoint)
for l=1:length(DOFDir)
p = p+1;
for k=1:Mlig*Mcol
c(k) = contains(Resp(k),DOFNamePoint(i)) && contains(Resp(k),DOFDir(l)) && contains(Ref(k), DOFNameRef(j)) && contains(Ref(k),DOFDir(n));
end
[NumLigne, NumCol] = NLignNCol(p,Mlig, Mcol);
M(NumLigne,NumCol,z) = Data(z, c);
end
end
end
end
end optimze, for loop MATLAB Answers — New Questions