Tag Archives: matlab
What is Mathworks Service Host?
I’m running Matlab 2023b on Ubuntu.
I’m just curious what this process is that’s been put in .config/autostart//mathworks-service-host.desktop to start at login?
Matlab starts fine without it but when I close Matlab, a process namber MathworksServiceHost keeps running.
It’s not a nice idea of having matlab-related processes running on the system after the application has been shut down. I have not noticed it on other version of Matlab. At least you should notify the user that a process is added to the autostart folder, and what it does.I’m running Matlab 2023b on Ubuntu.
I’m just curious what this process is that’s been put in .config/autostart//mathworks-service-host.desktop to start at login?
Matlab starts fine without it but when I close Matlab, a process namber MathworksServiceHost keeps running.
It’s not a nice idea of having matlab-related processes running on the system after the application has been shut down. I have not noticed it on other version of Matlab. At least you should notify the user that a process is added to the autostart folder, and what it does. I’m running Matlab 2023b on Ubuntu.
I’m just curious what this process is that’s been put in .config/autostart//mathworks-service-host.desktop to start at login?
Matlab starts fine without it but when I close Matlab, a process namber MathworksServiceHost keeps running.
It’s not a nice idea of having matlab-related processes running on the system after the application has been shut down. I have not noticed it on other version of Matlab. At least you should notify the user that a process is added to the autostart folder, and what it does. autostart, mathworksservicehost MATLAB Answers — New Questions
How to determine sampling frequency of wgn?
Hello there,
I’m trying to understand noise analysis and the concept of power spectral density. I’ve found this article:
https://pure.mpg.de/pubman/faces/ViewItemOverviewPage.jsp?itemId=item_152164
Which was really helpful and interesting, but I’ve encountered some problems while trying to put it in practise.
For convenience I wanted to generate white noise (mainly because of its flat spectral density) via wgn funtion and then calculate its PSD. If i understood it correctly, wgn creates discrete samples, which completely lack any relatationship to time.
And here comes my problem – while normalizing the results, equivalent noise bandwidth is dependent on sampling rate and so is PSD:
,
where w are window function values, S are complex results from fft function.
By experimenting with code I came upon sampling rate of 2 samples/s, when mean power of PSD was getting close to 5 dB. Unfortunatelly, I still cannot confidently explain this.
Is there please any way to obtain "realistic" white noise samples in MATLAB? Or do I have to add white noise to (co)sine signal with known sampling? If I’m missing something, please let me know.
Thank you in advance,
Jan
CODE:
% Size parameters
L = pow2(16);
iterations = 100;
% ??? (Guessed value)
fs = 2;
% Frequency resolution
f_res = fs/L;
% Create noise with power of 5 dBW
data = wgn(L,iterations, 5);
% Apply Hann window
h = hann(L);
w = ones(L,iterations) .* h;
data = data .* w;
% Calculate normalizing factor S2
S2 = sum(h.^2);
% Calculate fft
S = fft(data,L,1);
S = S .* conj(S);
% Average power spectrum
for i = 1:L
PSD(i) = mean(S(i,:));
end
% Normalize results
PSD = 2 * PSD / (fs * S2);
% Discard symmectric part
PSD = PSD(1:(L/2+1));
% PSD in dB(W)
PSD = 10*log10(PSD);
% Mean value of PSD
display("Power = " + mean(PSD) + " dB");
% Calculate frequency
f = (0:(L/2)) * f_res;
% Plot data
figure
plot(f,PSD)
xlabel("f [Hz]")
ylabel("PSD [dB/Hz]")Hello there,
I’m trying to understand noise analysis and the concept of power spectral density. I’ve found this article:
https://pure.mpg.de/pubman/faces/ViewItemOverviewPage.jsp?itemId=item_152164
Which was really helpful and interesting, but I’ve encountered some problems while trying to put it in practise.
For convenience I wanted to generate white noise (mainly because of its flat spectral density) via wgn funtion and then calculate its PSD. If i understood it correctly, wgn creates discrete samples, which completely lack any relatationship to time.
And here comes my problem – while normalizing the results, equivalent noise bandwidth is dependent on sampling rate and so is PSD:
,
where w are window function values, S are complex results from fft function.
By experimenting with code I came upon sampling rate of 2 samples/s, when mean power of PSD was getting close to 5 dB. Unfortunatelly, I still cannot confidently explain this.
Is there please any way to obtain "realistic" white noise samples in MATLAB? Or do I have to add white noise to (co)sine signal with known sampling? If I’m missing something, please let me know.
Thank you in advance,
Jan
CODE:
% Size parameters
L = pow2(16);
iterations = 100;
% ??? (Guessed value)
fs = 2;
% Frequency resolution
f_res = fs/L;
% Create noise with power of 5 dBW
data = wgn(L,iterations, 5);
% Apply Hann window
h = hann(L);
w = ones(L,iterations) .* h;
data = data .* w;
% Calculate normalizing factor S2
S2 = sum(h.^2);
% Calculate fft
S = fft(data,L,1);
S = S .* conj(S);
% Average power spectrum
for i = 1:L
PSD(i) = mean(S(i,:));
end
% Normalize results
PSD = 2 * PSD / (fs * S2);
% Discard symmectric part
PSD = PSD(1:(L/2+1));
% PSD in dB(W)
PSD = 10*log10(PSD);
% Mean value of PSD
display("Power = " + mean(PSD) + " dB");
% Calculate frequency
f = (0:(L/2)) * f_res;
% Plot data
figure
plot(f,PSD)
xlabel("f [Hz]")
ylabel("PSD [dB/Hz]") Hello there,
I’m trying to understand noise analysis and the concept of power spectral density. I’ve found this article:
https://pure.mpg.de/pubman/faces/ViewItemOverviewPage.jsp?itemId=item_152164
Which was really helpful and interesting, but I’ve encountered some problems while trying to put it in practise.
For convenience I wanted to generate white noise (mainly because of its flat spectral density) via wgn funtion and then calculate its PSD. If i understood it correctly, wgn creates discrete samples, which completely lack any relatationship to time.
And here comes my problem – while normalizing the results, equivalent noise bandwidth is dependent on sampling rate and so is PSD:
,
where w are window function values, S are complex results from fft function.
By experimenting with code I came upon sampling rate of 2 samples/s, when mean power of PSD was getting close to 5 dB. Unfortunatelly, I still cannot confidently explain this.
Is there please any way to obtain "realistic" white noise samples in MATLAB? Or do I have to add white noise to (co)sine signal with known sampling? If I’m missing something, please let me know.
Thank you in advance,
Jan
CODE:
% Size parameters
L = pow2(16);
iterations = 100;
% ??? (Guessed value)
fs = 2;
% Frequency resolution
f_res = fs/L;
% Create noise with power of 5 dBW
data = wgn(L,iterations, 5);
% Apply Hann window
h = hann(L);
w = ones(L,iterations) .* h;
data = data .* w;
% Calculate normalizing factor S2
S2 = sum(h.^2);
% Calculate fft
S = fft(data,L,1);
S = S .* conj(S);
% Average power spectrum
for i = 1:L
PSD(i) = mean(S(i,:));
end
% Normalize results
PSD = 2 * PSD / (fs * S2);
% Discard symmectric part
PSD = PSD(1:(L/2+1));
% PSD in dB(W)
PSD = 10*log10(PSD);
% Mean value of PSD
display("Power = " + mean(PSD) + " dB");
% Calculate frequency
f = (0:(L/2)) * f_res;
% Plot data
figure
plot(f,PSD)
xlabel("f [Hz]")
ylabel("PSD [dB/Hz]") psd, noise analysis, white noise, wgn, noise, matlab MATLAB Answers — New Questions
Overwriting the maximum function evaluation
Hi all, I have some data to be fitted with the function (please refer to my code). However, despite manually setting the maximumfunctionevaluation limit, the computer doesn’t seem to take it and it says the solver stops prematurely. May I ask what have I done wrong?
%% Preparation
clear;clc
data = importdata("FCPIB-293K-2.5mW-400nm-Jan072021 -ibg -bg -chirp.csv"); % insert file path within parenthesis
%% Preamble
% Fundamental constants
h = 4.0135667696*10^-15; % units: eV/ Hz
c = 3*10^8; % SI units
kB = 8.617333268*10^-5; % units: eV/ K
% Clean up of data to select range of values
wavelength = data(1:end, 1);
delay_t = data(1, 1:end); % conatains all of the delay times
E = (h*c)./(wavelength*10^-9); % contains all of the probe energies
Range_E = E>=1.5 & E<=2.2;
Range_T = delay_t>=0.5 & delay_t<=1000;
% for one delay time
T = find(Range_T);
T_min = min(T);
T_max = max(T);
t = 57; % choose an integer b/w T_min and T_max
delaytime = delay_t(1, t);
disp(delaytime)
% Initial parameter guess and bounds
lb = [0, 293, -1]; ub = [Inf, 1200, 1];
y0 = [2*10^9, 1000, 0.5];
% Data for fitting
E_p = E(Range_E); % selected probe energies
delta_Abs = -1*data(Range_E,t);
delta_Abs_norm = delta_Abs./max(abs(delta_Abs)); % normalised delta_Abs
Range_Efit = E_p>=1.62 & E_p<=max(E_p);
E_fit = E_p(Range_Efit);
delta_Abs_norm_fit = delta_Abs_norm(Range_Efit);
% Fitting function
function F = MB(y, E_fit)
F = y(1).*exp(-(E_fit./(8.617333268*10^-5.*y(2)))) + y(3);
end
%% Curve fitting options
% % Initial parameter guess and bounds
% lb = [0, 293, -1]; ub = [Inf, 800, 1];
% y0 = [1.2*10^9, 700, 0.5];
% lsqcurvefit and choose between different algorithm that lsqcurvefit employs (3C1, comment those lines that are not choosen and uncomment the line that is choosen, if not, matlab will take the last line of "optim_lsq" by default)
optim_lsq = optimoptions(‘lsqcurvefit’, ‘Algorithm’, ‘levenberg-marquardt’, ‘MaxFunctionEvaluations’,10^10, ‘MaxIterations’, 10^10, ‘FunctionTolerance’,10^-10, ‘StepTolerance’, 10^-10);
% optim_lsq = optimoptions(‘lsqcurvefit’, ‘Algorithm’, ‘trust-region-reflective’, ‘MaxFunctionEvaluations’,10^10, ‘MaxIterations’,10^10, ‘FunctionTolerance’,10^-20, ‘StepTolerance’, 10^-20);
% optim_lsq = optimoptions(‘lsqcurvefit’, ‘Algorithm’, ‘interior-point’, ‘MaxFunctionEvaluations’,1000, ‘MaxIterations’, 1000, ‘FunctionTolerance’,10^-20, ‘StepTolerance’, 10^-20);
% Solver for lsqcurvefit
[y, residualnorm, residual, exitflag, output, lambda, jacobian] = lsqcurvefit(@MB, y0, E_fit, delta_Abs_norm_fit, lb, ub);
%% Plot command
plot(E_p, delta_Abs_norm,’Black’)
hold on
plot(E_fit, MB(y, E_fit), ‘LineWidth’, 1.0, ‘Color’, ‘red’)
xlabel(‘Probe Photon Energy (eV)’)
ylabel(‘Normalised Delta A (a.u.)’)
legend(‘Experimental Data’, ‘Fitted Curve’)
disp(y(1,1))
disp(y(1,2))
disp(y(1,3))Hi all, I have some data to be fitted with the function (please refer to my code). However, despite manually setting the maximumfunctionevaluation limit, the computer doesn’t seem to take it and it says the solver stops prematurely. May I ask what have I done wrong?
%% Preparation
clear;clc
data = importdata("FCPIB-293K-2.5mW-400nm-Jan072021 -ibg -bg -chirp.csv"); % insert file path within parenthesis
%% Preamble
% Fundamental constants
h = 4.0135667696*10^-15; % units: eV/ Hz
c = 3*10^8; % SI units
kB = 8.617333268*10^-5; % units: eV/ K
% Clean up of data to select range of values
wavelength = data(1:end, 1);
delay_t = data(1, 1:end); % conatains all of the delay times
E = (h*c)./(wavelength*10^-9); % contains all of the probe energies
Range_E = E>=1.5 & E<=2.2;
Range_T = delay_t>=0.5 & delay_t<=1000;
% for one delay time
T = find(Range_T);
T_min = min(T);
T_max = max(T);
t = 57; % choose an integer b/w T_min and T_max
delaytime = delay_t(1, t);
disp(delaytime)
% Initial parameter guess and bounds
lb = [0, 293, -1]; ub = [Inf, 1200, 1];
y0 = [2*10^9, 1000, 0.5];
% Data for fitting
E_p = E(Range_E); % selected probe energies
delta_Abs = -1*data(Range_E,t);
delta_Abs_norm = delta_Abs./max(abs(delta_Abs)); % normalised delta_Abs
Range_Efit = E_p>=1.62 & E_p<=max(E_p);
E_fit = E_p(Range_Efit);
delta_Abs_norm_fit = delta_Abs_norm(Range_Efit);
% Fitting function
function F = MB(y, E_fit)
F = y(1).*exp(-(E_fit./(8.617333268*10^-5.*y(2)))) + y(3);
end
%% Curve fitting options
% % Initial parameter guess and bounds
% lb = [0, 293, -1]; ub = [Inf, 800, 1];
% y0 = [1.2*10^9, 700, 0.5];
% lsqcurvefit and choose between different algorithm that lsqcurvefit employs (3C1, comment those lines that are not choosen and uncomment the line that is choosen, if not, matlab will take the last line of "optim_lsq" by default)
optim_lsq = optimoptions(‘lsqcurvefit’, ‘Algorithm’, ‘levenberg-marquardt’, ‘MaxFunctionEvaluations’,10^10, ‘MaxIterations’, 10^10, ‘FunctionTolerance’,10^-10, ‘StepTolerance’, 10^-10);
% optim_lsq = optimoptions(‘lsqcurvefit’, ‘Algorithm’, ‘trust-region-reflective’, ‘MaxFunctionEvaluations’,10^10, ‘MaxIterations’,10^10, ‘FunctionTolerance’,10^-20, ‘StepTolerance’, 10^-20);
% optim_lsq = optimoptions(‘lsqcurvefit’, ‘Algorithm’, ‘interior-point’, ‘MaxFunctionEvaluations’,1000, ‘MaxIterations’, 1000, ‘FunctionTolerance’,10^-20, ‘StepTolerance’, 10^-20);
% Solver for lsqcurvefit
[y, residualnorm, residual, exitflag, output, lambda, jacobian] = lsqcurvefit(@MB, y0, E_fit, delta_Abs_norm_fit, lb, ub);
%% Plot command
plot(E_p, delta_Abs_norm,’Black’)
hold on
plot(E_fit, MB(y, E_fit), ‘LineWidth’, 1.0, ‘Color’, ‘red’)
xlabel(‘Probe Photon Energy (eV)’)
ylabel(‘Normalised Delta A (a.u.)’)
legend(‘Experimental Data’, ‘Fitted Curve’)
disp(y(1,1))
disp(y(1,2))
disp(y(1,3)) Hi all, I have some data to be fitted with the function (please refer to my code). However, despite manually setting the maximumfunctionevaluation limit, the computer doesn’t seem to take it and it says the solver stops prematurely. May I ask what have I done wrong?
%% Preparation
clear;clc
data = importdata("FCPIB-293K-2.5mW-400nm-Jan072021 -ibg -bg -chirp.csv"); % insert file path within parenthesis
%% Preamble
% Fundamental constants
h = 4.0135667696*10^-15; % units: eV/ Hz
c = 3*10^8; % SI units
kB = 8.617333268*10^-5; % units: eV/ K
% Clean up of data to select range of values
wavelength = data(1:end, 1);
delay_t = data(1, 1:end); % conatains all of the delay times
E = (h*c)./(wavelength*10^-9); % contains all of the probe energies
Range_E = E>=1.5 & E<=2.2;
Range_T = delay_t>=0.5 & delay_t<=1000;
% for one delay time
T = find(Range_T);
T_min = min(T);
T_max = max(T);
t = 57; % choose an integer b/w T_min and T_max
delaytime = delay_t(1, t);
disp(delaytime)
% Initial parameter guess and bounds
lb = [0, 293, -1]; ub = [Inf, 1200, 1];
y0 = [2*10^9, 1000, 0.5];
% Data for fitting
E_p = E(Range_E); % selected probe energies
delta_Abs = -1*data(Range_E,t);
delta_Abs_norm = delta_Abs./max(abs(delta_Abs)); % normalised delta_Abs
Range_Efit = E_p>=1.62 & E_p<=max(E_p);
E_fit = E_p(Range_Efit);
delta_Abs_norm_fit = delta_Abs_norm(Range_Efit);
% Fitting function
function F = MB(y, E_fit)
F = y(1).*exp(-(E_fit./(8.617333268*10^-5.*y(2)))) + y(3);
end
%% Curve fitting options
% % Initial parameter guess and bounds
% lb = [0, 293, -1]; ub = [Inf, 800, 1];
% y0 = [1.2*10^9, 700, 0.5];
% lsqcurvefit and choose between different algorithm that lsqcurvefit employs (3C1, comment those lines that are not choosen and uncomment the line that is choosen, if not, matlab will take the last line of "optim_lsq" by default)
optim_lsq = optimoptions(‘lsqcurvefit’, ‘Algorithm’, ‘levenberg-marquardt’, ‘MaxFunctionEvaluations’,10^10, ‘MaxIterations’, 10^10, ‘FunctionTolerance’,10^-10, ‘StepTolerance’, 10^-10);
% optim_lsq = optimoptions(‘lsqcurvefit’, ‘Algorithm’, ‘trust-region-reflective’, ‘MaxFunctionEvaluations’,10^10, ‘MaxIterations’,10^10, ‘FunctionTolerance’,10^-20, ‘StepTolerance’, 10^-20);
% optim_lsq = optimoptions(‘lsqcurvefit’, ‘Algorithm’, ‘interior-point’, ‘MaxFunctionEvaluations’,1000, ‘MaxIterations’, 1000, ‘FunctionTolerance’,10^-20, ‘StepTolerance’, 10^-20);
% Solver for lsqcurvefit
[y, residualnorm, residual, exitflag, output, lambda, jacobian] = lsqcurvefit(@MB, y0, E_fit, delta_Abs_norm_fit, lb, ub);
%% Plot command
plot(E_p, delta_Abs_norm,’Black’)
hold on
plot(E_fit, MB(y, E_fit), ‘LineWidth’, 1.0, ‘Color’, ‘red’)
xlabel(‘Probe Photon Energy (eV)’)
ylabel(‘Normalised Delta A (a.u.)’)
legend(‘Experimental Data’, ‘Fitted Curve’)
disp(y(1,1))
disp(y(1,2))
disp(y(1,3)) curve fitting, lsqcurvefit MATLAB Answers — New Questions
Difficulties converting E-001
Hi,
I’m importing an excel file to Matlab where example 45E-001 is divided into two column so A[1,1]= 45 and B[1,1]=E-001. "A" comes in as a double and "B" as a cell and when I’m trting to use str2double I only get Nan in each row. I would like to be able to do C = A .* B and that C[1,1] = 4.5.
Thank youHi,
I’m importing an excel file to Matlab where example 45E-001 is divided into two column so A[1,1]= 45 and B[1,1]=E-001. "A" comes in as a double and "B" as a cell and when I’m trting to use str2double I only get Nan in each row. I would like to be able to do C = A .* B and that C[1,1] = 4.5.
Thank you Hi,
I’m importing an excel file to Matlab where example 45E-001 is divided into two column so A[1,1]= 45 and B[1,1]=E-001. "A" comes in as a double and "B" as a cell and when I’m trting to use str2double I only get Nan in each row. I would like to be able to do C = A .* B and that C[1,1] = 4.5.
Thank you matlab, scientific number MATLAB Answers — New Questions
How do you compute the product of a matrix and each column of another matrix without a for loop in MATLAB, or is this just not possible?
A 4×14 matrix (C) is multiplied by each column of a 14xN matrix (x) – hence by N individual 14 element column vectors – to form N individual 4 element column vectors – represented by a 4xN matrix (y) -, where N is a known yet large number, let’s assume N = 132 for simplicity.
I use a for loop for this operation:
N = 132;
C = [0,1,0,0,0,0,0,0,0,-1,0,-0.68,0, 1.53;
0,0,0,1,0,0,0,0,0,-1,0,-0.64,0,-1.92;
0,0,0,0,0,1,0,0,0,-1,0, 0.86,0,-1.92;
0,0,0,0,0,0,0,1,0,-1,0, 0.91,0, 1.53];
x = rand(14,N);
for n = 1:N
y(:,n) = C*x(:,n);
end
y
This works fine, however, I wondered how this operation could be implemented without a for loop in MATLAB – all variables in the loop are available prior to the first iteration – to utilize MATLAB’s matrix multiplication optimization and thus improve runtime performance, or is this just not possible?
Thanks in advance for any help!A 4×14 matrix (C) is multiplied by each column of a 14xN matrix (x) – hence by N individual 14 element column vectors – to form N individual 4 element column vectors – represented by a 4xN matrix (y) -, where N is a known yet large number, let’s assume N = 132 for simplicity.
I use a for loop for this operation:
N = 132;
C = [0,1,0,0,0,0,0,0,0,-1,0,-0.68,0, 1.53;
0,0,0,1,0,0,0,0,0,-1,0,-0.64,0,-1.92;
0,0,0,0,0,1,0,0,0,-1,0, 0.86,0,-1.92;
0,0,0,0,0,0,0,1,0,-1,0, 0.91,0, 1.53];
x = rand(14,N);
for n = 1:N
y(:,n) = C*x(:,n);
end
y
This works fine, however, I wondered how this operation could be implemented without a for loop in MATLAB – all variables in the loop are available prior to the first iteration – to utilize MATLAB’s matrix multiplication optimization and thus improve runtime performance, or is this just not possible?
Thanks in advance for any help! A 4×14 matrix (C) is multiplied by each column of a 14xN matrix (x) – hence by N individual 14 element column vectors – to form N individual 4 element column vectors – represented by a 4xN matrix (y) -, where N is a known yet large number, let’s assume N = 132 for simplicity.
I use a for loop for this operation:
N = 132;
C = [0,1,0,0,0,0,0,0,0,-1,0,-0.68,0, 1.53;
0,0,0,1,0,0,0,0,0,-1,0,-0.64,0,-1.92;
0,0,0,0,0,1,0,0,0,-1,0, 0.86,0,-1.92;
0,0,0,0,0,0,0,1,0,-1,0, 0.91,0, 1.53];
x = rand(14,N);
for n = 1:N
y(:,n) = C*x(:,n);
end
y
This works fine, however, I wondered how this operation could be implemented without a for loop in MATLAB – all variables in the loop are available prior to the first iteration – to utilize MATLAB’s matrix multiplication optimization and thus improve runtime performance, or is this just not possible?
Thanks in advance for any help! matlab, matrix, for loop, matlab function, time series, speed MATLAB Answers — New Questions
How to continually clock in data during a simulation within Simulink
Hi,
I am experimenting within Simulink, and I wish to be able to run a simulation while clocking in input data several times during the simulation. I though to use a selector block and a counter limited block, however I keep getting run-time errors which identify a range problem with the idx input on the selector. I have set the Starting index (port) option in the selector and also set the input port size to 1, but the error says it is not in the permissable range (0 through 0).
I’m a bit confused with the error, and I am hoping it could be further explained. Further guidance would be appreciated.
I have attached a capture of my test with the parameters and the error for context.
Regards.Hi,
I am experimenting within Simulink, and I wish to be able to run a simulation while clocking in input data several times during the simulation. I though to use a selector block and a counter limited block, however I keep getting run-time errors which identify a range problem with the idx input on the selector. I have set the Starting index (port) option in the selector and also set the input port size to 1, but the error says it is not in the permissable range (0 through 0).
I’m a bit confused with the error, and I am hoping it could be further explained. Further guidance would be appreciated.
I have attached a capture of my test with the parameters and the error for context.
Regards. Hi,
I am experimenting within Simulink, and I wish to be able to run a simulation while clocking in input data several times during the simulation. I though to use a selector block and a counter limited block, however I keep getting run-time errors which identify a range problem with the idx input on the selector. I have set the Starting index (port) option in the selector and also set the input port size to 1, but the error says it is not in the permissable range (0 through 0).
I’m a bit confused with the error, and I am hoping it could be further explained. Further guidance would be appreciated.
I have attached a capture of my test with the parameters and the error for context.
Regards. selector block, counter limited, reset counter MATLAB Answers — New Questions
Control System Tuner always selects maximum value
Hey,
I am new to the Matlab Control System Toolbox and want to try out the Control System Tuner but I am facing a weird problem.
This is my control loop:
And I want to tune the PI controller to achieve a stable response. So I have specified the following Step Tracking Goal:
However, the Control System Tuner just gives me the maximum possible gain:
Does someone of you has an idea if I have to adjust the settings somehow or what else could be the reason for this behaviour?
ThanksHey,
I am new to the Matlab Control System Toolbox and want to try out the Control System Tuner but I am facing a weird problem.
This is my control loop:
And I want to tune the PI controller to achieve a stable response. So I have specified the following Step Tracking Goal:
However, the Control System Tuner just gives me the maximum possible gain:
Does someone of you has an idea if I have to adjust the settings somehow or what else could be the reason for this behaviour?
Thanks Hey,
I am new to the Matlab Control System Toolbox and want to try out the Control System Tuner but I am facing a weird problem.
This is my control loop:
And I want to tune the PI controller to achieve a stable response. So I have specified the following Step Tracking Goal:
However, the Control System Tuner just gives me the maximum possible gain:
Does someone of you has an idea if I have to adjust the settings somehow or what else could be the reason for this behaviour?
Thanks simulink, control MATLAB Answers — New Questions
How to use fft to analyse the refelction specturm?
I wanna get spatial frequency from FFT, just like the picture. I have already got the reflection spectrum.The wavelength and corresponding intensity are saved in Excel.
aa = xlsread(‘C:UsersjcDesktop6.27xx.xlsx’);
x = linspace(1510,1590,16001);%wavelength
y = aa(1:16001,2); %intensity
wavelength = x*1e-9;%nm
wavenumber = 1./wavelength;
wavenumberfit = linspace(wavenumber(1),wavenumber(16001),16001);I wanna get spatial frequency from FFT, just like the picture. I have already got the reflection spectrum.The wavelength and corresponding intensity are saved in Excel.
aa = xlsread(‘C:UsersjcDesktop6.27xx.xlsx’);
x = linspace(1510,1590,16001);%wavelength
y = aa(1:16001,2); %intensity
wavelength = x*1e-9;%nm
wavenumber = 1./wavelength;
wavenumberfit = linspace(wavenumber(1),wavenumber(16001),16001); I wanna get spatial frequency from FFT, just like the picture. I have already got the reflection spectrum.The wavelength and corresponding intensity are saved in Excel.
aa = xlsread(‘C:UsersjcDesktop6.27xx.xlsx’);
x = linspace(1510,1590,16001);%wavelength
y = aa(1:16001,2); %intensity
wavelength = x*1e-9;%nm
wavenumber = 1./wavelength;
wavenumberfit = linspace(wavenumber(1),wavenumber(16001),16001); fft, reflction spectrum, spatial frenquency MATLAB Answers — New Questions
Operands to the logical AND (&&) and OR (||) operators must be convertible to logical scalar values. Use the ANY or ALL functions to reduce operands to logical scalar values.
Hi, I get the following error with the given code,
"Operands to the logical AND (&&) and OR (||) operators must be convertible to logical scalar values. Use the ANY or ALL functions to reduce operands to logical scalar values."
This performs a minimization using the active set method. But seemingly, it stops over this operator problem.
Any ideas welcome!
% Define symbolic variables
syms x1 x2 x3 lambda1 lambda3
% Objective function
f = x1^2 + x2^2 + x3^2 – x1 + 2*x2 – 4*x3;
% Constraints
g1 = -x1 + x2 + 1; % -x1 + x2 >= -1 is equivalent to g1 <= 0
g2 = x1 + x2 + x3 + 3; % x1 + x2 + x3 >= -3 is equivalent to g2 <= 0
g3 = x3; % x3 >= 0 is equivalent to g3 <= 0
% Initial point
x0 = [0; 0; 0];
% Iterative process
x = x0;
activeSet = []; % Initially empty active set
maxIter = 10; % Maximum number of iterations
tol = 1e-6; % Tolerance for convergence
for iter = 1:maxIter
% Compute gradients of the objective function and constraints
grad_f = gradient(f, [x1, x2, x3]);
grad_g1 = gradient(g1, [x1, x2, x3]);
grad_g2 = gradient(g2, [x1, x2, x3]);
grad_g3 = gradient(g3, [x1, x2, x3]);
% Evaluate gradients at the current point
grad_f_val = double(subs(grad_f, {x1, x2, x3}, x’));
grad_g1_val = double(subs(grad_g1, {x1, x2, x3}, x’));
grad_g2_val = double(subs(grad_g2, {x1, x2, x3}, x’));
grad_g3_val = double(subs(grad_g3, {x1, x2, x3}, x’));
% Check KKT conditions to determine active set
if abs(grad_g1_val) < tol && subs(g1, {x1, x2, x3}, x’) <= 0
activeSet = [activeSet, 1]; % Constraint 1 is active
end
if abs(grad_g2_val) < tol && subs(g2, {x1, x2, x3}, x’) <= 0
activeSet = [activeSet, 2]; % Constraint 2 is active
end
if abs(grad_g3_val) < tol && subs(g3, {x1, x2, x3}, x’) <= 0
activeSet = [activeSet, 3]; % Constraint 3 is active
end
% Solve the subproblem using the active set
A_eq = [];
b_eq = [];
A_ineq = [];
b_ineq = [];
lb = [];
ub = [];
options = optimoptions(‘quadprog’, ‘Display’, ‘off’);
if any(activeSet == 1)
A_ineq = [A_ineq; -1, 1, 0];
b_ineq = [b_ineq; -1];
end
if any(activeSet == 2)
A_ineq = [A_ineq; 1, 1, 1];
b_ineq = [b_ineq; -3];
end
if any(activeSet == 3)
A_ineq = [A_ineq; 0, 0, 1];
b_ineq = [b_ineq; 0];
end
[x_new, ~, exitflag] = quadprog(eye(3), -grad_f_val’, A_ineq, b_ineq, A_eq, b_eq, lb, ub, [], options);
% Check convergence
if norm(x_new – x) < tol
break;
end
% Update x and active set
x = x_new;
activeSet = unique(activeSet);
end
% Display results
disp([‘Optimal point: x = [‘, num2str(x’), ‘]’]);
disp([‘Objective function value: ‘, num2str(double(subs(f, {x1, x2, x3}, x’)))]);Hi, I get the following error with the given code,
"Operands to the logical AND (&&) and OR (||) operators must be convertible to logical scalar values. Use the ANY or ALL functions to reduce operands to logical scalar values."
This performs a minimization using the active set method. But seemingly, it stops over this operator problem.
Any ideas welcome!
% Define symbolic variables
syms x1 x2 x3 lambda1 lambda3
% Objective function
f = x1^2 + x2^2 + x3^2 – x1 + 2*x2 – 4*x3;
% Constraints
g1 = -x1 + x2 + 1; % -x1 + x2 >= -1 is equivalent to g1 <= 0
g2 = x1 + x2 + x3 + 3; % x1 + x2 + x3 >= -3 is equivalent to g2 <= 0
g3 = x3; % x3 >= 0 is equivalent to g3 <= 0
% Initial point
x0 = [0; 0; 0];
% Iterative process
x = x0;
activeSet = []; % Initially empty active set
maxIter = 10; % Maximum number of iterations
tol = 1e-6; % Tolerance for convergence
for iter = 1:maxIter
% Compute gradients of the objective function and constraints
grad_f = gradient(f, [x1, x2, x3]);
grad_g1 = gradient(g1, [x1, x2, x3]);
grad_g2 = gradient(g2, [x1, x2, x3]);
grad_g3 = gradient(g3, [x1, x2, x3]);
% Evaluate gradients at the current point
grad_f_val = double(subs(grad_f, {x1, x2, x3}, x’));
grad_g1_val = double(subs(grad_g1, {x1, x2, x3}, x’));
grad_g2_val = double(subs(grad_g2, {x1, x2, x3}, x’));
grad_g3_val = double(subs(grad_g3, {x1, x2, x3}, x’));
% Check KKT conditions to determine active set
if abs(grad_g1_val) < tol && subs(g1, {x1, x2, x3}, x’) <= 0
activeSet = [activeSet, 1]; % Constraint 1 is active
end
if abs(grad_g2_val) < tol && subs(g2, {x1, x2, x3}, x’) <= 0
activeSet = [activeSet, 2]; % Constraint 2 is active
end
if abs(grad_g3_val) < tol && subs(g3, {x1, x2, x3}, x’) <= 0
activeSet = [activeSet, 3]; % Constraint 3 is active
end
% Solve the subproblem using the active set
A_eq = [];
b_eq = [];
A_ineq = [];
b_ineq = [];
lb = [];
ub = [];
options = optimoptions(‘quadprog’, ‘Display’, ‘off’);
if any(activeSet == 1)
A_ineq = [A_ineq; -1, 1, 0];
b_ineq = [b_ineq; -1];
end
if any(activeSet == 2)
A_ineq = [A_ineq; 1, 1, 1];
b_ineq = [b_ineq; -3];
end
if any(activeSet == 3)
A_ineq = [A_ineq; 0, 0, 1];
b_ineq = [b_ineq; 0];
end
[x_new, ~, exitflag] = quadprog(eye(3), -grad_f_val’, A_ineq, b_ineq, A_eq, b_eq, lb, ub, [], options);
% Check convergence
if norm(x_new – x) < tol
break;
end
% Update x and active set
x = x_new;
activeSet = unique(activeSet);
end
% Display results
disp([‘Optimal point: x = [‘, num2str(x’), ‘]’]);
disp([‘Objective function value: ‘, num2str(double(subs(f, {x1, x2, x3}, x’)))]); Hi, I get the following error with the given code,
"Operands to the logical AND (&&) and OR (||) operators must be convertible to logical scalar values. Use the ANY or ALL functions to reduce operands to logical scalar values."
This performs a minimization using the active set method. But seemingly, it stops over this operator problem.
Any ideas welcome!
% Define symbolic variables
syms x1 x2 x3 lambda1 lambda3
% Objective function
f = x1^2 + x2^2 + x3^2 – x1 + 2*x2 – 4*x3;
% Constraints
g1 = -x1 + x2 + 1; % -x1 + x2 >= -1 is equivalent to g1 <= 0
g2 = x1 + x2 + x3 + 3; % x1 + x2 + x3 >= -3 is equivalent to g2 <= 0
g3 = x3; % x3 >= 0 is equivalent to g3 <= 0
% Initial point
x0 = [0; 0; 0];
% Iterative process
x = x0;
activeSet = []; % Initially empty active set
maxIter = 10; % Maximum number of iterations
tol = 1e-6; % Tolerance for convergence
for iter = 1:maxIter
% Compute gradients of the objective function and constraints
grad_f = gradient(f, [x1, x2, x3]);
grad_g1 = gradient(g1, [x1, x2, x3]);
grad_g2 = gradient(g2, [x1, x2, x3]);
grad_g3 = gradient(g3, [x1, x2, x3]);
% Evaluate gradients at the current point
grad_f_val = double(subs(grad_f, {x1, x2, x3}, x’));
grad_g1_val = double(subs(grad_g1, {x1, x2, x3}, x’));
grad_g2_val = double(subs(grad_g2, {x1, x2, x3}, x’));
grad_g3_val = double(subs(grad_g3, {x1, x2, x3}, x’));
% Check KKT conditions to determine active set
if abs(grad_g1_val) < tol && subs(g1, {x1, x2, x3}, x’) <= 0
activeSet = [activeSet, 1]; % Constraint 1 is active
end
if abs(grad_g2_val) < tol && subs(g2, {x1, x2, x3}, x’) <= 0
activeSet = [activeSet, 2]; % Constraint 2 is active
end
if abs(grad_g3_val) < tol && subs(g3, {x1, x2, x3}, x’) <= 0
activeSet = [activeSet, 3]; % Constraint 3 is active
end
% Solve the subproblem using the active set
A_eq = [];
b_eq = [];
A_ineq = [];
b_ineq = [];
lb = [];
ub = [];
options = optimoptions(‘quadprog’, ‘Display’, ‘off’);
if any(activeSet == 1)
A_ineq = [A_ineq; -1, 1, 0];
b_ineq = [b_ineq; -1];
end
if any(activeSet == 2)
A_ineq = [A_ineq; 1, 1, 1];
b_ineq = [b_ineq; -3];
end
if any(activeSet == 3)
A_ineq = [A_ineq; 0, 0, 1];
b_ineq = [b_ineq; 0];
end
[x_new, ~, exitflag] = quadprog(eye(3), -grad_f_val’, A_ineq, b_ineq, A_eq, b_eq, lb, ub, [], options);
% Check convergence
if norm(x_new – x) < tol
break;
end
% Update x and active set
x = x_new;
activeSet = unique(activeSet);
end
% Display results
disp([‘Optimal point: x = [‘, num2str(x’), ‘]’]);
disp([‘Objective function value: ‘, num2str(double(subs(f, {x1, x2, x3}, x’)))]); operands, scalar, values MATLAB Answers — New Questions
I want to rotate matrix as well as image and want to show that output is invariant. Imrotate is effecting invariance so what should i do? % Generate a random 50×30 matrix A an
I want to rotate matrix as well as image and want to show that output is inavriant. Imrotate is effecting invariance so what should i do?
% Generate a random 50×30 matrix A and a 50×1 vector b
A = rand(8, 8);
b = rand(8, 1);
% A=[1 2;3 4];
% b=[1 2]’;
% Least squares solution for the original problem
x = (A’ * A) (A’ * b);
theta=90;
theta= deg2rad(theta);
% Rotation matrix for 90 degrees
R = [cos(theta), -sin(theta); sin(theta), cos(theta)];
% Extend the rotation matrix to apply to the whole problem
R_ext = blkdiag(kron(eye(1), R), eye(0)); % Adjust size accordingly
% Rotate the matrix and vector
A_rot = R_ext * A;
b_rot= R_ext * b;
theta= rad2deg(theta);
A_rot=imrotate(A_rot,theta,’crop’);
b_rot=imrotate(b_rot,theta,’crop’);
% Display the original and rotated matrices using imagesc
% Least squares solution for the rotated problem
x_rot = (A_rot’ * A_rot) (A_rot’ * b_rot);
% Display results
fprintf(‘Original least squares solution (first 5 elements):n’);
disp(x(1:end));
fprintf(‘Rotated least squares solution (first 5 elements):n’);
disp(x_rot(1:end));
% Check invariance
invariance_check = norm(x )- norm(x_rot);
fprintf(‘Invariance check (should be close to zero): %fn’, invariance_check);I want to rotate matrix as well as image and want to show that output is inavriant. Imrotate is effecting invariance so what should i do?
% Generate a random 50×30 matrix A and a 50×1 vector b
A = rand(8, 8);
b = rand(8, 1);
% A=[1 2;3 4];
% b=[1 2]’;
% Least squares solution for the original problem
x = (A’ * A) (A’ * b);
theta=90;
theta= deg2rad(theta);
% Rotation matrix for 90 degrees
R = [cos(theta), -sin(theta); sin(theta), cos(theta)];
% Extend the rotation matrix to apply to the whole problem
R_ext = blkdiag(kron(eye(1), R), eye(0)); % Adjust size accordingly
% Rotate the matrix and vector
A_rot = R_ext * A;
b_rot= R_ext * b;
theta= rad2deg(theta);
A_rot=imrotate(A_rot,theta,’crop’);
b_rot=imrotate(b_rot,theta,’crop’);
% Display the original and rotated matrices using imagesc
% Least squares solution for the rotated problem
x_rot = (A_rot’ * A_rot) (A_rot’ * b_rot);
% Display results
fprintf(‘Original least squares solution (first 5 elements):n’);
disp(x(1:end));
fprintf(‘Rotated least squares solution (first 5 elements):n’);
disp(x_rot(1:end));
% Check invariance
invariance_check = norm(x )- norm(x_rot);
fprintf(‘Invariance check (should be close to zero): %fn’, invariance_check); I want to rotate matrix as well as image and want to show that output is inavriant. Imrotate is effecting invariance so what should i do?
% Generate a random 50×30 matrix A and a 50×1 vector b
A = rand(8, 8);
b = rand(8, 1);
% A=[1 2;3 4];
% b=[1 2]’;
% Least squares solution for the original problem
x = (A’ * A) (A’ * b);
theta=90;
theta= deg2rad(theta);
% Rotation matrix for 90 degrees
R = [cos(theta), -sin(theta); sin(theta), cos(theta)];
% Extend the rotation matrix to apply to the whole problem
R_ext = blkdiag(kron(eye(1), R), eye(0)); % Adjust size accordingly
% Rotate the matrix and vector
A_rot = R_ext * A;
b_rot= R_ext * b;
theta= rad2deg(theta);
A_rot=imrotate(A_rot,theta,’crop’);
b_rot=imrotate(b_rot,theta,’crop’);
% Display the original and rotated matrices using imagesc
% Least squares solution for the rotated problem
x_rot = (A_rot’ * A_rot) (A_rot’ * b_rot);
% Display results
fprintf(‘Original least squares solution (first 5 elements):n’);
disp(x(1:end));
fprintf(‘Rotated least squares solution (first 5 elements):n’);
disp(x_rot(1:end));
% Check invariance
invariance_check = norm(x )- norm(x_rot);
fprintf(‘Invariance check (should be close to zero): %fn’, invariance_check); matlab MATLAB Answers — New Questions
Unable to write to file, because it appears to be corrupt.
I am doing a long calculations and they keep being interrupted constantly at random (as i assume) places. When re-running the code to save the ""corrupted" file once again, it without any problem. then, the problem repeats itself further down the file numbers. Due to the fact that the file is saved after re-running of the code, i assume it wasn’t corrupted in the first place. So i don’t really know what exactly the problem is. Would appreciate some help or suggestions. thanks!I am doing a long calculations and they keep being interrupted constantly at random (as i assume) places. When re-running the code to save the ""corrupted" file once again, it without any problem. then, the problem repeats itself further down the file numbers. Due to the fact that the file is saved after re-running of the code, i assume it wasn’t corrupted in the first place. So i don’t really know what exactly the problem is. Would appreciate some help or suggestions. thanks! I am doing a long calculations and they keep being interrupted constantly at random (as i assume) places. When re-running the code to save the ""corrupted" file once again, it without any problem. then, the problem repeats itself further down the file numbers. Due to the fact that the file is saved after re-running of the code, i assume it wasn’t corrupted in the first place. So i don’t really know what exactly the problem is. Would appreciate some help or suggestions. thanks! corrupted file, matlab, database MATLAB Answers — New Questions
errors about mdfimport command
hello, when i restart my laptop, the command mdfimport can not works, following is the error, how to handle this.hello, when i restart my laptop, the command mdfimport can not works, following is the error, how to handle this. hello, when i restart my laptop, the command mdfimport can not works, following is the error, how to handle this. mdfimport MATLAB Answers — New Questions
Value must be a scalar
Hi, I am having a problem while I use the genetic algorithm. When I use the ga with only 3 populations it works, but when I increase the populations it gives me an error that a value must be a scalar.
I diden’t understand why he gives the error only when I increase the population fron 3 onwards. Maybe someone knows the problem and could help me?Hi, I am having a problem while I use the genetic algorithm. When I use the ga with only 3 populations it works, but when I increase the populations it gives me an error that a value must be a scalar.
I diden’t understand why he gives the error only when I increase the population fron 3 onwards. Maybe someone knows the problem and could help me? Hi, I am having a problem while I use the genetic algorithm. When I use the ga with only 3 populations it works, but when I increase the populations it gives me an error that a value must be a scalar.
I diden’t understand why he gives the error only when I increase the population fron 3 onwards. Maybe someone knows the problem and could help me? matlab, error, function, optimization, genetic algorithm MATLAB Answers — New Questions
2 Patterns TDD Slot Configurations support
Does the 5G Toolbox supports configuring 2 patterns in the TDD Slot configuration?Does the 5G Toolbox supports configuring 2 patterns in the TDD Slot configuration? Does the 5G Toolbox supports configuring 2 patterns in the TDD Slot configuration? 5g toolbox, tddconfig MATLAB Answers — New Questions
NETCDF error in MATLAB 2023b
Hi All,
I am using MATLAB 2023b trial version and can not work with NETCDF files.
In this case I am not able to simply read one netcdf file. What is going on?
Did I miss any matlab installation file? Is it a bug version? See below
the error I get:
>> test
Error using mexcdf
## Unrecognized Matlab version.
Error in ncread (line 46)
[ncid]=mexcdf(‘ncopen’,fname,’nc_nowrite’);
Error in netcdf_load (line 15)
val = ncread(ncfile,varname);
Error in test (line 3)
netcdf_load(‘swa12_2_grd.nc’);
>>
Thanks for any help,
LucianoHi All,
I am using MATLAB 2023b trial version and can not work with NETCDF files.
In this case I am not able to simply read one netcdf file. What is going on?
Did I miss any matlab installation file? Is it a bug version? See below
the error I get:
>> test
Error using mexcdf
## Unrecognized Matlab version.
Error in ncread (line 46)
[ncid]=mexcdf(‘ncopen’,fname,’nc_nowrite’);
Error in netcdf_load (line 15)
val = ncread(ncfile,varname);
Error in test (line 3)
netcdf_load(‘swa12_2_grd.nc’);
>>
Thanks for any help,
Luciano Hi All,
I am using MATLAB 2023b trial version and can not work with NETCDF files.
In this case I am not able to simply read one netcdf file. What is going on?
Did I miss any matlab installation file? Is it a bug version? See below
the error I get:
>> test
Error using mexcdf
## Unrecognized Matlab version.
Error in ncread (line 46)
[ncid]=mexcdf(‘ncopen’,fname,’nc_nowrite’);
Error in netcdf_load (line 15)
val = ncread(ncfile,varname);
Error in test (line 3)
netcdf_load(‘swa12_2_grd.nc’);
>>
Thanks for any help,
Luciano netcdf, matlab 2023b MATLAB Answers — New Questions
hNRUplinkWaveformGenerator Usage in the 5G Waveform Generation
While Generating the 5G waveform the normal flow uses hNRReferenceWaveformGenerator, so when should we use the hNRUplinkWaveformGenerator and when should we use hNRReferenceWaveformGenerator?While Generating the 5G waveform the normal flow uses hNRReferenceWaveformGenerator, so when should we use the hNRUplinkWaveformGenerator and when should we use hNRReferenceWaveformGenerator? While Generating the 5G waveform the normal flow uses hNRReferenceWaveformGenerator, so when should we use the hNRUplinkWaveformGenerator and when should we use hNRReferenceWaveformGenerator? 5g toolbox MATLAB Answers — New Questions
Index exceeds the number of array elements. Index must not exceed 1
I dont understand why it stops after the first iteration and gives this error:
"Index exceeds the number of array elements. Index must not exceed 1"
g=9.8
nu= 10^-6 ;
c=1/2 ;
var_Y=0.1;
I_Y= 2.8;
s= 5;
C_beta=zeros(s)
C_Y=zeros(s)
S=0:1:4
for i=1:s
C_Y= (var_Y^2)*exp(abs(-S(i)./I_Y))
C_beta= (1/ (exp(c*var_y^2)))* ( ( exp(0.5*c*(c+1)*((var_y)^2) ) -1 )^2- c*(c+1) *(exp(0.5*c*(c+1)*(var_y)^2)-1)*(exp(var_y^2)-1)+(c^2)*(exp(C_Y(i))-1) )
plot (S,C_beta)
endI dont understand why it stops after the first iteration and gives this error:
"Index exceeds the number of array elements. Index must not exceed 1"
g=9.8
nu= 10^-6 ;
c=1/2 ;
var_Y=0.1;
I_Y= 2.8;
s= 5;
C_beta=zeros(s)
C_Y=zeros(s)
S=0:1:4
for i=1:s
C_Y= (var_Y^2)*exp(abs(-S(i)./I_Y))
C_beta= (1/ (exp(c*var_y^2)))* ( ( exp(0.5*c*(c+1)*((var_y)^2) ) -1 )^2- c*(c+1) *(exp(0.5*c*(c+1)*(var_y)^2)-1)*(exp(var_y^2)-1)+(c^2)*(exp(C_Y(i))-1) )
plot (S,C_beta)
end I dont understand why it stops after the first iteration and gives this error:
"Index exceeds the number of array elements. Index must not exceed 1"
g=9.8
nu= 10^-6 ;
c=1/2 ;
var_Y=0.1;
I_Y= 2.8;
s= 5;
C_beta=zeros(s)
C_Y=zeros(s)
S=0:1:4
for i=1:s
C_Y= (var_Y^2)*exp(abs(-S(i)./I_Y))
C_beta= (1/ (exp(c*var_y^2)))* ( ( exp(0.5*c*(c+1)*((var_y)^2) ) -1 )^2- c*(c+1) *(exp(0.5*c*(c+1)*(var_y)^2)-1)*(exp(var_y^2)-1)+(c^2)*(exp(C_Y(i))-1) )
plot (S,C_beta)
end for loop, index exceeds MATLAB Answers — New Questions
simulink编译报错找不到LibGCCarm_cortexm3l_mathlibCMSISDSP.a
### 正在启动 STM32F103_BK 的编译过程
### 正在为 ‘模型特定’ 文件夹结构生成代码和工件
### 正在将代码生成到编译文件夹中: D:simulinkSTMSTM32F103_BK_ert_rtw
### Invoking Target Language Compiler on STM32F103_BK.rtw
### Using System Target File: D:Program FilesMATLABR2023brtwcertert.tlc
### Loading TLC function libraries
…….
### Initial pass through model to cache user defined code
.
### Caching model source code
…………………………
### Writing header file STM32F103_BK_types.h
### Writing header file STM32F103_BK.h
### Writing header file rtwtypes.h
.
### Writing source file STM32F103_BK.c
### Writing header file STM32F103_BK_private.h
### Writing source file STM32F103_BK_data.c
### Writing header file rtmodel.h
### Writing source file ert_main.c
.
### TLC code generation complete (took 2.339s).
### 正在保存二进制信息缓存。
### STM32F103_BK 的编译过程因错误而中止。
编译的顶层模型目标:
模型 操作 重新编译原因
================================
STM32F103_BK 失败 代码生成信息文件不存在。
编译了 0 个模型,共 1 个模型(0 个模型已经是最新的)
编译持续时间: 0h 0m 14.185s
错误:Build process stopped at compile stage. Unable to find the following link-only objects that are specified in the build information:
LibGCCarm_cortexm3l_mathlibCMSISDSP.a### 正在启动 STM32F103_BK 的编译过程
### 正在为 ‘模型特定’ 文件夹结构生成代码和工件
### 正在将代码生成到编译文件夹中: D:simulinkSTMSTM32F103_BK_ert_rtw
### Invoking Target Language Compiler on STM32F103_BK.rtw
### Using System Target File: D:Program FilesMATLABR2023brtwcertert.tlc
### Loading TLC function libraries
…….
### Initial pass through model to cache user defined code
.
### Caching model source code
…………………………
### Writing header file STM32F103_BK_types.h
### Writing header file STM32F103_BK.h
### Writing header file rtwtypes.h
.
### Writing source file STM32F103_BK.c
### Writing header file STM32F103_BK_private.h
### Writing source file STM32F103_BK_data.c
### Writing header file rtmodel.h
### Writing source file ert_main.c
.
### TLC code generation complete (took 2.339s).
### 正在保存二进制信息缓存。
### STM32F103_BK 的编译过程因错误而中止。
编译的顶层模型目标:
模型 操作 重新编译原因
================================
STM32F103_BK 失败 代码生成信息文件不存在。
编译了 0 个模型,共 1 个模型(0 个模型已经是最新的)
编译持续时间: 0h 0m 14.185s
错误:Build process stopped at compile stage. Unable to find the following link-only objects that are specified in the build information:
LibGCCarm_cortexm3l_mathlibCMSISDSP.a ### 正在启动 STM32F103_BK 的编译过程
### 正在为 ‘模型特定’ 文件夹结构生成代码和工件
### 正在将代码生成到编译文件夹中: D:simulinkSTMSTM32F103_BK_ert_rtw
### Invoking Target Language Compiler on STM32F103_BK.rtw
### Using System Target File: D:Program FilesMATLABR2023brtwcertert.tlc
### Loading TLC function libraries
…….
### Initial pass through model to cache user defined code
.
### Caching model source code
…………………………
### Writing header file STM32F103_BK_types.h
### Writing header file STM32F103_BK.h
### Writing header file rtwtypes.h
.
### Writing source file STM32F103_BK.c
### Writing header file STM32F103_BK_private.h
### Writing source file STM32F103_BK_data.c
### Writing header file rtmodel.h
### Writing source file ert_main.c
.
### TLC code generation complete (took 2.339s).
### 正在保存二进制信息缓存。
### STM32F103_BK 的编译过程因错误而中止。
编译的顶层模型目标:
模型 操作 重新编译原因
================================
STM32F103_BK 失败 代码生成信息文件不存在。
编译了 0 个模型,共 1 个模型(0 个模型已经是最新的)
编译持续时间: 0h 0m 14.185s
错误:Build process stopped at compile stage. Unable to find the following link-only objects that are specified in the build information:
LibGCCarm_cortexm3l_mathlibCMSISDSP.a 代码生成 MATLAB Answers — New Questions
How to include an image with original resolution in a Live Script?
I am creating an exercise for a course with a Live Script in Matlab 2016a.
I made some PNG drawings with free body diagrams. Unfortunately when they are inserted the Live Script, the image quality is dramatically decreased, making the text in the images very difficult to read.
I tried also TIFF and JPEG with the same results.
Is there a way to include an image in a Live Script with the original quality and resolution?
Where can I suggest the addition of support for SVG or some format that support vector images?
Thank you.I am creating an exercise for a course with a Live Script in Matlab 2016a.
I made some PNG drawings with free body diagrams. Unfortunately when they are inserted the Live Script, the image quality is dramatically decreased, making the text in the images very difficult to read.
I tried also TIFF and JPEG with the same results.
Is there a way to include an image in a Live Script with the original quality and resolution?
Where can I suggest the addition of support for SVG or some format that support vector images?
Thank you. I am creating an exercise for a course with a Live Script in Matlab 2016a.
I made some PNG drawings with free body diagrams. Unfortunately when they are inserted the Live Script, the image quality is dramatically decreased, making the text in the images very difficult to read.
I tried also TIFF and JPEG with the same results.
Is there a way to include an image in a Live Script with the original quality and resolution?
Where can I suggest the addition of support for SVG or some format that support vector images?
Thank you. live script, livescript MATLAB Answers — New Questions
Unable to start MATLAB R2023a in Ubuntu Linux 23.04, it stops after “MATLAB is selecting SOFTWARE OPENGL rendering.” message
Hi there,
I’m trying to solve this problem for hours, yet I don’t have any solution. Looked through installation docs, but couldn’t find why the problem occurs. I installed MATLAB R2023a without a problem via the ISO file which my school gave me. When I try to run the matlab, "MATLAB is selecting SOFTWARE OPENGL rendering." message comes and after a second, process stops without an error(?). The program wouldn’t start either.
My gcc and g++ versions were 12, I downgraded them to 11 since its says the latest version it supports is 11 in Matlab docs. However it didn’t work.
I also tried
./matlab -nosoftwareopengl
this time the message I mentioned earlier doesn’t come up, but process again stops after a second.
I checked my system resources, my CPU usage increases for a second but memory usage stands still.
I installed two times into different locations to check if it’s about permissions or whatnot, but it didn’t help.
I tried other suggestions from this forum, but no help.
No solution yet.. I’d be happy if we can sort this out 🙁
My machine has AMD Ryzen 4600H as a CPU, and also integrated GPU known as AMD Radeon Graphics.
UPDATE:
I tried to use free-trial version from the website, it’s R2023b and worked fine. These are the some logs after running it:
MATLAB is selecting SOFTWARE OPENGL rendering.
Fontconfig warning: "/usr/share/fontconfig/conf.avail/05-reset-dirs-sample.conf", line 6: unknown element "reset-dirs"
Gtk-Message: 21:36:13.537: Failed to load module "canberra-gtk-module"
MESA-LOADER: failed to open radeonsi: /usr/lib/dri/radeonsi_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
MESA-LOADER: failed to open zink: /usr/lib/dri/zink_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
MESA-LOADER: failed to open kms_swrast: /usr/lib/dri/kms_swrast_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
MESA-LOADER: failed to open swrast: /usr/lib/dri/swrast_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
Also when I run some basic tasks like imshow(), and rgb2gray(); it gives this warning:
Warning: MATLAB has disabled some advanced graphics rendering features by switching to software OpenGL. For more information,
click here.
I’m adding these outputs for troubleshooting. If you need anything else, I can provide happily!Hi there,
I’m trying to solve this problem for hours, yet I don’t have any solution. Looked through installation docs, but couldn’t find why the problem occurs. I installed MATLAB R2023a without a problem via the ISO file which my school gave me. When I try to run the matlab, "MATLAB is selecting SOFTWARE OPENGL rendering." message comes and after a second, process stops without an error(?). The program wouldn’t start either.
My gcc and g++ versions were 12, I downgraded them to 11 since its says the latest version it supports is 11 in Matlab docs. However it didn’t work.
I also tried
./matlab -nosoftwareopengl
this time the message I mentioned earlier doesn’t come up, but process again stops after a second.
I checked my system resources, my CPU usage increases for a second but memory usage stands still.
I installed two times into different locations to check if it’s about permissions or whatnot, but it didn’t help.
I tried other suggestions from this forum, but no help.
No solution yet.. I’d be happy if we can sort this out 🙁
My machine has AMD Ryzen 4600H as a CPU, and also integrated GPU known as AMD Radeon Graphics.
UPDATE:
I tried to use free-trial version from the website, it’s R2023b and worked fine. These are the some logs after running it:
MATLAB is selecting SOFTWARE OPENGL rendering.
Fontconfig warning: "/usr/share/fontconfig/conf.avail/05-reset-dirs-sample.conf", line 6: unknown element "reset-dirs"
Gtk-Message: 21:36:13.537: Failed to load module "canberra-gtk-module"
MESA-LOADER: failed to open radeonsi: /usr/lib/dri/radeonsi_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
MESA-LOADER: failed to open zink: /usr/lib/dri/zink_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
MESA-LOADER: failed to open kms_swrast: /usr/lib/dri/kms_swrast_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
MESA-LOADER: failed to open swrast: /usr/lib/dri/swrast_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
Also when I run some basic tasks like imshow(), and rgb2gray(); it gives this warning:
Warning: MATLAB has disabled some advanced graphics rendering features by switching to software OpenGL. For more information,
click here.
I’m adding these outputs for troubleshooting. If you need anything else, I can provide happily! Hi there,
I’m trying to solve this problem for hours, yet I don’t have any solution. Looked through installation docs, but couldn’t find why the problem occurs. I installed MATLAB R2023a without a problem via the ISO file which my school gave me. When I try to run the matlab, "MATLAB is selecting SOFTWARE OPENGL rendering." message comes and after a second, process stops without an error(?). The program wouldn’t start either.
My gcc and g++ versions were 12, I downgraded them to 11 since its says the latest version it supports is 11 in Matlab docs. However it didn’t work.
I also tried
./matlab -nosoftwareopengl
this time the message I mentioned earlier doesn’t come up, but process again stops after a second.
I checked my system resources, my CPU usage increases for a second but memory usage stands still.
I installed two times into different locations to check if it’s about permissions or whatnot, but it didn’t help.
I tried other suggestions from this forum, but no help.
No solution yet.. I’d be happy if we can sort this out 🙁
My machine has AMD Ryzen 4600H as a CPU, and also integrated GPU known as AMD Radeon Graphics.
UPDATE:
I tried to use free-trial version from the website, it’s R2023b and worked fine. These are the some logs after running it:
MATLAB is selecting SOFTWARE OPENGL rendering.
Fontconfig warning: "/usr/share/fontconfig/conf.avail/05-reset-dirs-sample.conf", line 6: unknown element "reset-dirs"
Gtk-Message: 21:36:13.537: Failed to load module "canberra-gtk-module"
MESA-LOADER: failed to open radeonsi: /usr/lib/dri/radeonsi_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
MESA-LOADER: failed to open zink: /usr/lib/dri/zink_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
MESA-LOADER: failed to open kms_swrast: /usr/lib/dri/kms_swrast_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
MESA-LOADER: failed to open swrast: /usr/lib/dri/swrast_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
Also when I run some basic tasks like imshow(), and rgb2gray(); it gives this warning:
Warning: MATLAB has disabled some advanced graphics rendering features by switching to software OpenGL. For more information,
click here.
I’m adding these outputs for troubleshooting. If you need anything else, I can provide happily! matlab, installation, opengl, r2023a, linux MATLAB Answers — New Questions