Tag Archives: matlab
Generate a SPWM signal with Digital output of C2000 microcontroller blockset or with ePWM of C2000 microcontroller blockset
I have a C2000 F28027F and I am controlling it with simulink. I have the need to create a SPWM signal, so I thought I would make the comparison between triangular and sinusoidal signal with simulink blocks and thus obtain the output pulses, and I connect them to digital output blocks of C2000 Microcontroller Blockset as shown in the image. My question is, is it valid to do it like this? Or could it cause problems? My intention in principle was to use the exclusive ePWM block for these applications, however, it does not allow comparison between two signals to be able to perform the SPWM technique.I have a C2000 F28027F and I am controlling it with simulink. I have the need to create a SPWM signal, so I thought I would make the comparison between triangular and sinusoidal signal with simulink blocks and thus obtain the output pulses, and I connect them to digital output blocks of C2000 Microcontroller Blockset as shown in the image. My question is, is it valid to do it like this? Or could it cause problems? My intention in principle was to use the exclusive ePWM block for these applications, however, it does not allow comparison between two signals to be able to perform the SPWM technique. I have a C2000 F28027F and I am controlling it with simulink. I have the need to create a SPWM signal, so I thought I would make the comparison between triangular and sinusoidal signal with simulink blocks and thus obtain the output pulses, and I connect them to digital output blocks of C2000 Microcontroller Blockset as shown in the image. My question is, is it valid to do it like this? Or could it cause problems? My intention in principle was to use the exclusive ePWM block for these applications, however, it does not allow comparison between two signals to be able to perform the SPWM technique. texas instruments, spwm, c2000 microcontroller blockset, digital output, epwm, ti, signal, simulink MATLAB Answers — New Questions
How do I setup MATLAB Web App Server authentication and authorization with Azure AD?
While there is information in the MATLAB Web App Server documentation on setting up authentication and authorization with OpenID and Azure AD is shown as a specific example, the information is pretty high-level. Can you provide a more detailed guide aimed at Azure AD specifically?While there is information in the MATLAB Web App Server documentation on setting up authentication and authorization with OpenID and Azure AD is shown as a specific example, the information is pretty high-level. Can you provide a more detailed guide aimed at Azure AD specifically? While there is information in the MATLAB Web App Server documentation on setting up authentication and authorization with OpenID and Azure AD is shown as a specific example, the information is pretty high-level. Can you provide a more detailed guide aimed at Azure AD specifically? MATLAB Answers — New Questions
Want to know the use of the “config.m.eml” and “logger.m.eml” files.
When I checked the matlab file today, I found two files "config.m.eml" and "logger.m.eml". The modification date of these two files is strange, so I want to know what the purpose of these two files is.When I checked the matlab file today, I found two files "config.m.eml" and "logger.m.eml". The modification date of these two files is strange, so I want to know what the purpose of these two files is. When I checked the matlab file today, I found two files "config.m.eml" and "logger.m.eml". The modification date of these two files is strange, so I want to know what the purpose of these two files is. file MATLAB Answers — New Questions
Returning solution of system of equation as NaN solution
Following code is trying to find the solution of t and k by solving two equation. Matlab keeps returning NaN. What’s the issue?
% Define the symbolic variables
syms k t m dt_dk
% Define the main expression with t as a function of k
expr = ((1 – k)^(1/2)*(t^6*(2*m*(3*m + 2) + 4) – t^5*(m*(m*(5*m + 6) + 11) + 12) + m^6 + 2*t^7 – t^8 – t^4*(m*(3*m*(m*(3*m + 2) – 3) – 16) – 9) – 2*m^3*t^2*(3*m^3 + 2*m + 3) + m^2*t^3*(m*(3*m*(5*m + 4) + 1) – 4)) + k^(1/2)*(t^4*(m*(9*m*(m*(m + 4) + 5) + 28) + 9) – m^4*(3*m – 2) – t^6*(6*m*(m + 2) + 10) + t^5*(4*m^3 + 12*m + 8) + t^8 + m*t^2*(m*(m*(4*m^3 + 3*m + 9) + 6) – 8) + 2*m^2*t*(3*m – 2) – 2*m*t^3*(m*(m*(6*m*(m + 2) + 7) + 6) – 2))) / (18*t^3*(2*t – (m – t)^2));
% Derivative of t with respect to k (symbolically)
dt_dk_expr = diff(t, k);
% Differentiate the main expression with respect to k, taking into account dt/dk
diff_expr = diff(expr, k) + diff(expr, t) * dt_dk;
% Define the fixed-point equation
fixed_point_eq = (((k)^(1/2))*(((m/t)+2)/3) – ((1-k)^(1/2))*((1/3)*(2+ (m/t)+((2*m+t)/(((m-t)^2)-2*t)))))/(((k)^(1/2))*(2*(m^3) – 3*((1+m)^2)*t + t^3)/(3*(((m-t)^2)-2*t)) – ((1-k)^(1/2))*((2*m+t)/3)) – t;
% Define the range of m values
m_values = linspace(0.01, 0.99, 100); % Adjusted range to avoid edge cases (0 and 1)
% Preallocate arrays to store solutions
k_solutions = zeros(size(m_values));
t_solutions = zeros(size(m_values));
% Loop over m values and solve the system of equations for each m
for i = 1:length(m_values)
m_value = m_values(i);
% Substitute the current m value into the equations
diff_eq_sub = subs(diff_expr, m, m_value);
fixed_eq_sub = subs(fixed_point_eq, m, m_value);
% Solve the system of equations
% Note: vpasolve automatically adjusts precision based on the symbolic nature
sol = vpasolve([diff_eq_sub == 0, fixed_eq_sub], [k, t, dt_dk]);
% Extract solutions
if ~isempty(sol.k) && ~isempty(sol.t)
k_solutions(i) = double(sol.k);
t_solutions(i) = double(sol.t);
else
k_solutions(i) = NaN;
t_solutions(i) = NaN;
end
end
% Display solutions
disp(‘Solutions for each m:’);
for i = 1:length(m_values)
fprintf(‘m = %.4f, k = %.4f, t = %.4fn’, m_values(i), k_solutions(i), t_solutions(i));
end
% Plot solutions
figure;
plot(m_values, k_solutions, ‘-o’, ‘DisplayName’, ‘k’);
hold on;
plot(m_values, t_solutions, ‘-o’, ‘DisplayName’, ‘t’);
xlabel(‘m’);
ylabel(‘Values’);
title(‘Solutions as a Function of m’);
legend(‘k’, ‘t’);
hold off;Following code is trying to find the solution of t and k by solving two equation. Matlab keeps returning NaN. What’s the issue?
% Define the symbolic variables
syms k t m dt_dk
% Define the main expression with t as a function of k
expr = ((1 – k)^(1/2)*(t^6*(2*m*(3*m + 2) + 4) – t^5*(m*(m*(5*m + 6) + 11) + 12) + m^6 + 2*t^7 – t^8 – t^4*(m*(3*m*(m*(3*m + 2) – 3) – 16) – 9) – 2*m^3*t^2*(3*m^3 + 2*m + 3) + m^2*t^3*(m*(3*m*(5*m + 4) + 1) – 4)) + k^(1/2)*(t^4*(m*(9*m*(m*(m + 4) + 5) + 28) + 9) – m^4*(3*m – 2) – t^6*(6*m*(m + 2) + 10) + t^5*(4*m^3 + 12*m + 8) + t^8 + m*t^2*(m*(m*(4*m^3 + 3*m + 9) + 6) – 8) + 2*m^2*t*(3*m – 2) – 2*m*t^3*(m*(m*(6*m*(m + 2) + 7) + 6) – 2))) / (18*t^3*(2*t – (m – t)^2));
% Derivative of t with respect to k (symbolically)
dt_dk_expr = diff(t, k);
% Differentiate the main expression with respect to k, taking into account dt/dk
diff_expr = diff(expr, k) + diff(expr, t) * dt_dk;
% Define the fixed-point equation
fixed_point_eq = (((k)^(1/2))*(((m/t)+2)/3) – ((1-k)^(1/2))*((1/3)*(2+ (m/t)+((2*m+t)/(((m-t)^2)-2*t)))))/(((k)^(1/2))*(2*(m^3) – 3*((1+m)^2)*t + t^3)/(3*(((m-t)^2)-2*t)) – ((1-k)^(1/2))*((2*m+t)/3)) – t;
% Define the range of m values
m_values = linspace(0.01, 0.99, 100); % Adjusted range to avoid edge cases (0 and 1)
% Preallocate arrays to store solutions
k_solutions = zeros(size(m_values));
t_solutions = zeros(size(m_values));
% Loop over m values and solve the system of equations for each m
for i = 1:length(m_values)
m_value = m_values(i);
% Substitute the current m value into the equations
diff_eq_sub = subs(diff_expr, m, m_value);
fixed_eq_sub = subs(fixed_point_eq, m, m_value);
% Solve the system of equations
% Note: vpasolve automatically adjusts precision based on the symbolic nature
sol = vpasolve([diff_eq_sub == 0, fixed_eq_sub], [k, t, dt_dk]);
% Extract solutions
if ~isempty(sol.k) && ~isempty(sol.t)
k_solutions(i) = double(sol.k);
t_solutions(i) = double(sol.t);
else
k_solutions(i) = NaN;
t_solutions(i) = NaN;
end
end
% Display solutions
disp(‘Solutions for each m:’);
for i = 1:length(m_values)
fprintf(‘m = %.4f, k = %.4f, t = %.4fn’, m_values(i), k_solutions(i), t_solutions(i));
end
% Plot solutions
figure;
plot(m_values, k_solutions, ‘-o’, ‘DisplayName’, ‘k’);
hold on;
plot(m_values, t_solutions, ‘-o’, ‘DisplayName’, ‘t’);
xlabel(‘m’);
ylabel(‘Values’);
title(‘Solutions as a Function of m’);
legend(‘k’, ‘t’);
hold off; Following code is trying to find the solution of t and k by solving two equation. Matlab keeps returning NaN. What’s the issue?
% Define the symbolic variables
syms k t m dt_dk
% Define the main expression with t as a function of k
expr = ((1 – k)^(1/2)*(t^6*(2*m*(3*m + 2) + 4) – t^5*(m*(m*(5*m + 6) + 11) + 12) + m^6 + 2*t^7 – t^8 – t^4*(m*(3*m*(m*(3*m + 2) – 3) – 16) – 9) – 2*m^3*t^2*(3*m^3 + 2*m + 3) + m^2*t^3*(m*(3*m*(5*m + 4) + 1) – 4)) + k^(1/2)*(t^4*(m*(9*m*(m*(m + 4) + 5) + 28) + 9) – m^4*(3*m – 2) – t^6*(6*m*(m + 2) + 10) + t^5*(4*m^3 + 12*m + 8) + t^8 + m*t^2*(m*(m*(4*m^3 + 3*m + 9) + 6) – 8) + 2*m^2*t*(3*m – 2) – 2*m*t^3*(m*(m*(6*m*(m + 2) + 7) + 6) – 2))) / (18*t^3*(2*t – (m – t)^2));
% Derivative of t with respect to k (symbolically)
dt_dk_expr = diff(t, k);
% Differentiate the main expression with respect to k, taking into account dt/dk
diff_expr = diff(expr, k) + diff(expr, t) * dt_dk;
% Define the fixed-point equation
fixed_point_eq = (((k)^(1/2))*(((m/t)+2)/3) – ((1-k)^(1/2))*((1/3)*(2+ (m/t)+((2*m+t)/(((m-t)^2)-2*t)))))/(((k)^(1/2))*(2*(m^3) – 3*((1+m)^2)*t + t^3)/(3*(((m-t)^2)-2*t)) – ((1-k)^(1/2))*((2*m+t)/3)) – t;
% Define the range of m values
m_values = linspace(0.01, 0.99, 100); % Adjusted range to avoid edge cases (0 and 1)
% Preallocate arrays to store solutions
k_solutions = zeros(size(m_values));
t_solutions = zeros(size(m_values));
% Loop over m values and solve the system of equations for each m
for i = 1:length(m_values)
m_value = m_values(i);
% Substitute the current m value into the equations
diff_eq_sub = subs(diff_expr, m, m_value);
fixed_eq_sub = subs(fixed_point_eq, m, m_value);
% Solve the system of equations
% Note: vpasolve automatically adjusts precision based on the symbolic nature
sol = vpasolve([diff_eq_sub == 0, fixed_eq_sub], [k, t, dt_dk]);
% Extract solutions
if ~isempty(sol.k) && ~isempty(sol.t)
k_solutions(i) = double(sol.k);
t_solutions(i) = double(sol.t);
else
k_solutions(i) = NaN;
t_solutions(i) = NaN;
end
end
% Display solutions
disp(‘Solutions for each m:’);
for i = 1:length(m_values)
fprintf(‘m = %.4f, k = %.4f, t = %.4fn’, m_values(i), k_solutions(i), t_solutions(i));
end
% Plot solutions
figure;
plot(m_values, k_solutions, ‘-o’, ‘DisplayName’, ‘k’);
hold on;
plot(m_values, t_solutions, ‘-o’, ‘DisplayName’, ‘t’);
xlabel(‘m’);
ylabel(‘Values’);
title(‘Solutions as a Function of m’);
legend(‘k’, ‘t’);
hold off; nan, optimization, differential equations MATLAB Answers — New Questions
Discrete convolution in time/Laplace domain
Hello,
I’m dealing with a problem where I need to calculate a convolution in the time domain again and again, so efficiency is a big issue.
I need to evaluate the following formula
numerically. I know as a analytical function (which btw can also be transformed analytically in the time domain); but I have only as discrete values . That means I need to evaluate in discrete form to obtain .
I have used FFT to solve some convolution in the Fourier space, but this Laplace transforms seem to be much more challenging numerically. Is maybe z-transforms the way to go? I would be very thankfull for any guidance on the topic.
Thank you.Hello,
I’m dealing with a problem where I need to calculate a convolution in the time domain again and again, so efficiency is a big issue.
I need to evaluate the following formula
numerically. I know as a analytical function (which btw can also be transformed analytically in the time domain); but I have only as discrete values . That means I need to evaluate in discrete form to obtain .
I have used FFT to solve some convolution in the Fourier space, but this Laplace transforms seem to be much more challenging numerically. Is maybe z-transforms the way to go? I would be very thankfull for any guidance on the topic.
Thank you. Hello,
I’m dealing with a problem where I need to calculate a convolution in the time domain again and again, so efficiency is a big issue.
I need to evaluate the following formula
numerically. I know as a analytical function (which btw can also be transformed analytically in the time domain); but I have only as discrete values . That means I need to evaluate in discrete form to obtain .
I have used FFT to solve some convolution in the Fourier space, but this Laplace transforms seem to be much more challenging numerically. Is maybe z-transforms the way to go? I would be very thankfull for any guidance on the topic.
Thank you. laplace transform, z transform, convolution in time MATLAB Answers — New Questions
Optimal Cutoff Frequency for Static Noise Detection in ECG Signals?
Hello MATLAB Community,
I am currently working on optimizing the detection of static noise in ECG signals and would greatly appreciate your expertise. Specifically, I am looking to determine the best cutoff frequency for filtering this noise. Below, I have listed the SNR (Signal-to-Noise Ratio) values for different cutoff frequencies in two leads, Lead I and Lead aVL:
Cutoff Frequency = 0.5 Hz
SNR in Lead I: 7.98 dB
SNR in Lead aVL: 5.41 dB
Cutoff Frequency = 1.0 Hz
SNR in Lead I: 7.29 dB
SNR in Lead aVL: 5.11 dB
Cutoff Frequency = 5.0 Hz
SNR in Lead I: 4.03 dB
SNR in Lead aVL: 3.23 dB
Cutoff Frequency = 10.0 Hz
SNR in Lead I: 2.17 dB
SNR in Lead aVL: 1.96 dB
Quantification of Noise:
Cutoff Frequency = 0.5 Hz
Number of noise points in Lead I: 299
Number of noise points in Lead aVL: 341
Cutoff Frequency = 1.0 Hz
Number of noise points in Lead I: 278
Number of noise points in Lead aVL: 304
Cutoff Frequency = 5.0 Hz
Number of noise points in Lead I: 179
Number of noise points in Lead aVL: 213
Cutoff Frequency = 10.0 Hz
Number of noise points in Lead I: 127
Number of noise points in Lead aVL: 137
Additionally, I have attached an image showing the residuals ( lead I ) .
To determine the best threshold value, I used an approach based on minimizing the number of noise points detected in the filtered signal. Here is a detailed explanation of the process:
Process to determine the best threshold value
Calculation of the filtered signal:
For each cutoff frequency, I applied a high-pass filter to remove low-frequency components from the ECG signal.
Threshold definition:
I tested different threshold values, defined as multiples of the standard deviation (STD) of the filtered signal. The tested thresholds were 0.25 * STD, 0.5 * STD, 0.75 * STD, and 1 * STD.
Noise point detection:
For each threshold value, I detected points in the filtered signal where the amplitude exceeds the threshold.
The number of detected noise points is counted for each threshold value.
Selection of the best threshold:
The best threshold is the one that minimizes the number of detected noise points. The hypothesis is that the optimal threshold eliminates noise without affecting the useful components of the ECG signal.
Based on this data, I am seeking advice on the most suitable cutoff frequency for effectively reducing static noise while preserving the integrity of the ECG signal. Any suggestions or insights into methodologies for determining this would be highly valuable.
Thank you in advance for your help!
Best regards,Hello MATLAB Community,
I am currently working on optimizing the detection of static noise in ECG signals and would greatly appreciate your expertise. Specifically, I am looking to determine the best cutoff frequency for filtering this noise. Below, I have listed the SNR (Signal-to-Noise Ratio) values for different cutoff frequencies in two leads, Lead I and Lead aVL:
Cutoff Frequency = 0.5 Hz
SNR in Lead I: 7.98 dB
SNR in Lead aVL: 5.41 dB
Cutoff Frequency = 1.0 Hz
SNR in Lead I: 7.29 dB
SNR in Lead aVL: 5.11 dB
Cutoff Frequency = 5.0 Hz
SNR in Lead I: 4.03 dB
SNR in Lead aVL: 3.23 dB
Cutoff Frequency = 10.0 Hz
SNR in Lead I: 2.17 dB
SNR in Lead aVL: 1.96 dB
Quantification of Noise:
Cutoff Frequency = 0.5 Hz
Number of noise points in Lead I: 299
Number of noise points in Lead aVL: 341
Cutoff Frequency = 1.0 Hz
Number of noise points in Lead I: 278
Number of noise points in Lead aVL: 304
Cutoff Frequency = 5.0 Hz
Number of noise points in Lead I: 179
Number of noise points in Lead aVL: 213
Cutoff Frequency = 10.0 Hz
Number of noise points in Lead I: 127
Number of noise points in Lead aVL: 137
Additionally, I have attached an image showing the residuals ( lead I ) .
To determine the best threshold value, I used an approach based on minimizing the number of noise points detected in the filtered signal. Here is a detailed explanation of the process:
Process to determine the best threshold value
Calculation of the filtered signal:
For each cutoff frequency, I applied a high-pass filter to remove low-frequency components from the ECG signal.
Threshold definition:
I tested different threshold values, defined as multiples of the standard deviation (STD) of the filtered signal. The tested thresholds were 0.25 * STD, 0.5 * STD, 0.75 * STD, and 1 * STD.
Noise point detection:
For each threshold value, I detected points in the filtered signal where the amplitude exceeds the threshold.
The number of detected noise points is counted for each threshold value.
Selection of the best threshold:
The best threshold is the one that minimizes the number of detected noise points. The hypothesis is that the optimal threshold eliminates noise without affecting the useful components of the ECG signal.
Based on this data, I am seeking advice on the most suitable cutoff frequency for effectively reducing static noise while preserving the integrity of the ECG signal. Any suggestions or insights into methodologies for determining this would be highly valuable.
Thank you in advance for your help!
Best regards, Hello MATLAB Community,
I am currently working on optimizing the detection of static noise in ECG signals and would greatly appreciate your expertise. Specifically, I am looking to determine the best cutoff frequency for filtering this noise. Below, I have listed the SNR (Signal-to-Noise Ratio) values for different cutoff frequencies in two leads, Lead I and Lead aVL:
Cutoff Frequency = 0.5 Hz
SNR in Lead I: 7.98 dB
SNR in Lead aVL: 5.41 dB
Cutoff Frequency = 1.0 Hz
SNR in Lead I: 7.29 dB
SNR in Lead aVL: 5.11 dB
Cutoff Frequency = 5.0 Hz
SNR in Lead I: 4.03 dB
SNR in Lead aVL: 3.23 dB
Cutoff Frequency = 10.0 Hz
SNR in Lead I: 2.17 dB
SNR in Lead aVL: 1.96 dB
Quantification of Noise:
Cutoff Frequency = 0.5 Hz
Number of noise points in Lead I: 299
Number of noise points in Lead aVL: 341
Cutoff Frequency = 1.0 Hz
Number of noise points in Lead I: 278
Number of noise points in Lead aVL: 304
Cutoff Frequency = 5.0 Hz
Number of noise points in Lead I: 179
Number of noise points in Lead aVL: 213
Cutoff Frequency = 10.0 Hz
Number of noise points in Lead I: 127
Number of noise points in Lead aVL: 137
Additionally, I have attached an image showing the residuals ( lead I ) .
To determine the best threshold value, I used an approach based on minimizing the number of noise points detected in the filtered signal. Here is a detailed explanation of the process:
Process to determine the best threshold value
Calculation of the filtered signal:
For each cutoff frequency, I applied a high-pass filter to remove low-frequency components from the ECG signal.
Threshold definition:
I tested different threshold values, defined as multiples of the standard deviation (STD) of the filtered signal. The tested thresholds were 0.25 * STD, 0.5 * STD, 0.75 * STD, and 1 * STD.
Noise point detection:
For each threshold value, I detected points in the filtered signal where the amplitude exceeds the threshold.
The number of detected noise points is counted for each threshold value.
Selection of the best threshold:
The best threshold is the one that minimizes the number of detected noise points. The hypothesis is that the optimal threshold eliminates noise without affecting the useful components of the ECG signal.
Based on this data, I am seeking advice on the most suitable cutoff frequency for effectively reducing static noise while preserving the integrity of the ECG signal. Any suggestions or insights into methodologies for determining this would be highly valuable.
Thank you in advance for your help!
Best regards, ecg, signal processing, noises, static_noise, ptb_xl, snr MATLAB Answers — New Questions
RL PPO agent diverges with one-step training
Hi,
I am training my PPO agent based on a system with continuous action space, and I want to have my agent trains for only one step and one episode in each train() function, and see how it performs:
trainingOpts = rlTrainingOptions(…
MaxEpisodes=1, …
MaxStepsPerEpisode=1, …
Verbose=false, …
Plots="none",…
StopTrainingCriteria="AverageReward",…
StopTrainingValue=480);
This is the settings of the agent:
function [agents,obsInfo,actionInfo] = generate_PPOagents(Ts)
%observation and action spaces
obsInfo = rlNumericSpec([2 1],’LowerLimit’,-inf*ones(2,1),’UpperLimit’,inf*ones(2,1));
obsInfo.Name = ‘state’;
obsInfo.Description = ‘position, velocity’;
actionInfo = rlNumericSpec([1 1],’LowerLimit’,-inf,’UpperLimit’,inf);
actionInfo.Name = ‘continuousAction’;
agentOptions = rlPPOAgentOptions(…
‘DiscountFactor’, 0.99,…
‘EntropyLossWeight’, 0.01,…
‘ExperienceHorizon’, 20,…
‘MiniBatchSize’, 20,…
‘ClipFactor’, 0.2,…
‘NormalizedAdvantageMethod’,’none’,…
‘SampleTime’, -1);
agent1 = rlPPOAgent(obsInfo, actionInfo, agentOptions);
agent2 = rlPPOAgent(obsInfo, actionInfo, agentOptions);
agents = [agent1,agent2];
end
my reward is a conditional one based on whether the states satisfy some conditions:
function [nextObs, reward, isDone, loggedSignals] = myStepFunction1(action, loggedSignals,S)
nextObs = S.A1d*[loggedSignals.State(1);loggedSignals.State(2)] + S.B1d*action;
loggedSignals.State = nextObs;
if abs(nextObs(1))>10 || abs(nextObs(2))>10
reward = S.test-100;
else
reward = -1*(nextObs(1)^2 + nextObs(2)^2);
end
isDone = false;
end
in this case, every time the system finishes train(), the agent moves forward 1 step using getAction(), then I modify the reset function and then update the env so that each time the next train() simulates, the agent will start at the new state, then do trian() again to carry out the loop. But when I simulate the system, the states diverges to Inf after just around 20 train() iterations, I have checked my env, the agent settings, all seems fine. I tested if the issue is from the penalty in the reward function by changing S.test above, but the simulation fails as well.
I am not sure if the issue is caused by the one episode one step training method, in theory I am expecting bad performance at first but it should not be diverging so fast to Inf.
Thanks.Hi,
I am training my PPO agent based on a system with continuous action space, and I want to have my agent trains for only one step and one episode in each train() function, and see how it performs:
trainingOpts = rlTrainingOptions(…
MaxEpisodes=1, …
MaxStepsPerEpisode=1, …
Verbose=false, …
Plots="none",…
StopTrainingCriteria="AverageReward",…
StopTrainingValue=480);
This is the settings of the agent:
function [agents,obsInfo,actionInfo] = generate_PPOagents(Ts)
%observation and action spaces
obsInfo = rlNumericSpec([2 1],’LowerLimit’,-inf*ones(2,1),’UpperLimit’,inf*ones(2,1));
obsInfo.Name = ‘state’;
obsInfo.Description = ‘position, velocity’;
actionInfo = rlNumericSpec([1 1],’LowerLimit’,-inf,’UpperLimit’,inf);
actionInfo.Name = ‘continuousAction’;
agentOptions = rlPPOAgentOptions(…
‘DiscountFactor’, 0.99,…
‘EntropyLossWeight’, 0.01,…
‘ExperienceHorizon’, 20,…
‘MiniBatchSize’, 20,…
‘ClipFactor’, 0.2,…
‘NormalizedAdvantageMethod’,’none’,…
‘SampleTime’, -1);
agent1 = rlPPOAgent(obsInfo, actionInfo, agentOptions);
agent2 = rlPPOAgent(obsInfo, actionInfo, agentOptions);
agents = [agent1,agent2];
end
my reward is a conditional one based on whether the states satisfy some conditions:
function [nextObs, reward, isDone, loggedSignals] = myStepFunction1(action, loggedSignals,S)
nextObs = S.A1d*[loggedSignals.State(1);loggedSignals.State(2)] + S.B1d*action;
loggedSignals.State = nextObs;
if abs(nextObs(1))>10 || abs(nextObs(2))>10
reward = S.test-100;
else
reward = -1*(nextObs(1)^2 + nextObs(2)^2);
end
isDone = false;
end
in this case, every time the system finishes train(), the agent moves forward 1 step using getAction(), then I modify the reset function and then update the env so that each time the next train() simulates, the agent will start at the new state, then do trian() again to carry out the loop. But when I simulate the system, the states diverges to Inf after just around 20 train() iterations, I have checked my env, the agent settings, all seems fine. I tested if the issue is from the penalty in the reward function by changing S.test above, but the simulation fails as well.
I am not sure if the issue is caused by the one episode one step training method, in theory I am expecting bad performance at first but it should not be diverging so fast to Inf.
Thanks. Hi,
I am training my PPO agent based on a system with continuous action space, and I want to have my agent trains for only one step and one episode in each train() function, and see how it performs:
trainingOpts = rlTrainingOptions(…
MaxEpisodes=1, …
MaxStepsPerEpisode=1, …
Verbose=false, …
Plots="none",…
StopTrainingCriteria="AverageReward",…
StopTrainingValue=480);
This is the settings of the agent:
function [agents,obsInfo,actionInfo] = generate_PPOagents(Ts)
%observation and action spaces
obsInfo = rlNumericSpec([2 1],’LowerLimit’,-inf*ones(2,1),’UpperLimit’,inf*ones(2,1));
obsInfo.Name = ‘state’;
obsInfo.Description = ‘position, velocity’;
actionInfo = rlNumericSpec([1 1],’LowerLimit’,-inf,’UpperLimit’,inf);
actionInfo.Name = ‘continuousAction’;
agentOptions = rlPPOAgentOptions(…
‘DiscountFactor’, 0.99,…
‘EntropyLossWeight’, 0.01,…
‘ExperienceHorizon’, 20,…
‘MiniBatchSize’, 20,…
‘ClipFactor’, 0.2,…
‘NormalizedAdvantageMethod’,’none’,…
‘SampleTime’, -1);
agent1 = rlPPOAgent(obsInfo, actionInfo, agentOptions);
agent2 = rlPPOAgent(obsInfo, actionInfo, agentOptions);
agents = [agent1,agent2];
end
my reward is a conditional one based on whether the states satisfy some conditions:
function [nextObs, reward, isDone, loggedSignals] = myStepFunction1(action, loggedSignals,S)
nextObs = S.A1d*[loggedSignals.State(1);loggedSignals.State(2)] + S.B1d*action;
loggedSignals.State = nextObs;
if abs(nextObs(1))>10 || abs(nextObs(2))>10
reward = S.test-100;
else
reward = -1*(nextObs(1)^2 + nextObs(2)^2);
end
isDone = false;
end
in this case, every time the system finishes train(), the agent moves forward 1 step using getAction(), then I modify the reset function and then update the env so that each time the next train() simulates, the agent will start at the new state, then do trian() again to carry out the loop. But when I simulate the system, the states diverges to Inf after just around 20 train() iterations, I have checked my env, the agent settings, all seems fine. I tested if the issue is from the penalty in the reward function by changing S.test above, but the simulation fails as well.
I am not sure if the issue is caused by the one episode one step training method, in theory I am expecting bad performance at first but it should not be diverging so fast to Inf.
Thanks. ppo, reinforcement learning, training, converge MATLAB Answers — New Questions
Raytracing channel and showProfile
Hello everyone, i have one question about the showProfile command. I study an urban enviroment with raytracing propagation model, using the channel = comm.RayTracingChannel(rays, tx, rx) object. I obtain the channel, and with these i can found the channel impulse response if i dont use any input:
CIR = channel( )
After i use the showProfile(channel) and i plot the power delay profile. Can i obtain the same plot using the sample from the CIR? Because i want to save the magnitude of every tap from the power delay profile, but with the showProfile command is not possible so i have to recreate those from myself.Hello everyone, i have one question about the showProfile command. I study an urban enviroment with raytracing propagation model, using the channel = comm.RayTracingChannel(rays, tx, rx) object. I obtain the channel, and with these i can found the channel impulse response if i dont use any input:
CIR = channel( )
After i use the showProfile(channel) and i plot the power delay profile. Can i obtain the same plot using the sample from the CIR? Because i want to save the magnitude of every tap from the power delay profile, but with the showProfile command is not possible so i have to recreate those from myself. Hello everyone, i have one question about the showProfile command. I study an urban enviroment with raytracing propagation model, using the channel = comm.RayTracingChannel(rays, tx, rx) object. I obtain the channel, and with these i can found the channel impulse response if i dont use any input:
CIR = channel( )
After i use the showProfile(channel) and i plot the power delay profile. Can i obtain the same plot using the sample from the CIR? Because i want to save the magnitude of every tap from the power delay profile, but with the showProfile command is not possible so i have to recreate those from myself. raytracing, showprofile MATLAB Answers — New Questions
Cannot solve algebraic loop involving ‘Mo_phong_xe/Equation1_ddgama1/MATLAB Function5’ because it consists of blocks that cannot be assigned algebraic variables, such as block
Cannot solve algebraic loop involving ‘Mo_phong_xe/Equation1_ddgama1/MATLAB Function5’ because it consists of blocks that cannot be assigned algebraic variables, such as blocks with discrete-valued outputs, blocks with non-double or complex outputs, Stateflow blocks, or nonvirtual subsystems. Consider breaking the algebraic loop. For example, add a delay or a memory block to the loop. To see more details about the loops use the command Simulink.BlockDiagram.getAlgebraicLoops(bdroot)
Component:Simulink | Category:Model error
Input ports (23) of ‘Mo_phong_xe/Equation1_ddgama1/MATLAB Function5’ are involved in the loop.Cannot solve algebraic loop involving ‘Mo_phong_xe/Equation1_ddgama1/MATLAB Function5’ because it consists of blocks that cannot be assigned algebraic variables, such as blocks with discrete-valued outputs, blocks with non-double or complex outputs, Stateflow blocks, or nonvirtual subsystems. Consider breaking the algebraic loop. For example, add a delay or a memory block to the loop. To see more details about the loops use the command Simulink.BlockDiagram.getAlgebraicLoops(bdroot)
Component:Simulink | Category:Model error
Input ports (23) of ‘Mo_phong_xe/Equation1_ddgama1/MATLAB Function5’ are involved in the loop. Cannot solve algebraic loop involving ‘Mo_phong_xe/Equation1_ddgama1/MATLAB Function5’ because it consists of blocks that cannot be assigned algebraic variables, such as blocks with discrete-valued outputs, blocks with non-double or complex outputs, Stateflow blocks, or nonvirtual subsystems. Consider breaking the algebraic loop. For example, add a delay or a memory block to the loop. To see more details about the loops use the command Simulink.BlockDiagram.getAlgebraicLoops(bdroot)
Component:Simulink | Category:Model error
Input ports (23) of ‘Mo_phong_xe/Equation1_ddgama1/MATLAB Function5’ are involved in the loop. error MATLAB Answers — New Questions
Find index of a nearest value
Hello there,
If I have a data: x = [1 2 3 4 5 6 11 15 21 51 52 54 100 101 151 201 251 301 401];
Anyone knows how to get the index of the value close to a certain values: 10, 20, 50, 100, 150, 200, 250, 300, 400?
In this case, the index should be related to the x = 11, 21, etc.
thanksHello there,
If I have a data: x = [1 2 3 4 5 6 11 15 21 51 52 54 100 101 151 201 251 301 401];
Anyone knows how to get the index of the value close to a certain values: 10, 20, 50, 100, 150, 200, 250, 300, 400?
In this case, the index should be related to the x = 11, 21, etc.
thanks Hello there,
If I have a data: x = [1 2 3 4 5 6 11 15 21 51 52 54 100 101 151 201 251 301 401];
Anyone knows how to get the index of the value close to a certain values: 10, 20, 50, 100, 150, 200, 250, 300, 400?
In this case, the index should be related to the x = 11, 21, etc.
thanks index MATLAB Answers — New Questions
Convert MATLAB .m Files to a .jar File for Use in a Java Project in MATLAB R2024a
I’m working with MATLAB R2024a and I have several .m files, each defining a different function. I need to convert all these .m files into a single .jar file so that I can use these functions in a Java project.
How can I achieve this?
Here’s an example of what one of my .m files looks like:
function [output] = myFunction(input)
…
endI’m working with MATLAB R2024a and I have several .m files, each defining a different function. I need to convert all these .m files into a single .jar file so that I can use these functions in a Java project.
How can I achieve this?
Here’s an example of what one of my .m files looks like:
function [output] = myFunction(input)
…
end I’m working with MATLAB R2024a and I have several .m files, each defining a different function. I need to convert all these .m files into a single .jar file so that I can use these functions in a Java project.
How can I achieve this?
Here’s an example of what one of my .m files looks like:
function [output] = myFunction(input)
…
end java, jar, compiler MATLAB Answers — New Questions
Num of max consective occurance of ‘T’
Hi,
I have a set of cyclone data that I am trying to analyse. in the sample timetable, each system is described by unique id, for each id i want to count the MAX CONSECTIIVE occuance of ‘T’ in the ‘thrsh’ column. I also want to know the closest location of the next or previous ‘T’ after of before the max conseitive occuance for each system. the final table should be [id, maxOcc, nextLoc]. Some selected ids are shown below:
id = 1990S001, maxOcc = 2, nextT = 0 (no occurance of next or previous T after or before F)
id = 1990S005, maxOcc = 2, nextT = 0
id = 1990S014, maxOcc = 5, nextT = -8 (8th occurance of T before F)
id = 1990S019, maxOcc = 3, nextT = -2 (2nd occurance of T before F)
High appreciate your help.
ThanksHi,
I have a set of cyclone data that I am trying to analyse. in the sample timetable, each system is described by unique id, for each id i want to count the MAX CONSECTIIVE occuance of ‘T’ in the ‘thrsh’ column. I also want to know the closest location of the next or previous ‘T’ after of before the max conseitive occuance for each system. the final table should be [id, maxOcc, nextLoc]. Some selected ids are shown below:
id = 1990S001, maxOcc = 2, nextT = 0 (no occurance of next or previous T after or before F)
id = 1990S005, maxOcc = 2, nextT = 0
id = 1990S014, maxOcc = 5, nextT = -8 (8th occurance of T before F)
id = 1990S019, maxOcc = 3, nextT = -2 (2nd occurance of T before F)
High appreciate your help.
Thanks Hi,
I have a set of cyclone data that I am trying to analyse. in the sample timetable, each system is described by unique id, for each id i want to count the MAX CONSECTIIVE occuance of ‘T’ in the ‘thrsh’ column. I also want to know the closest location of the next or previous ‘T’ after of before the max conseitive occuance for each system. the final table should be [id, maxOcc, nextLoc]. Some selected ids are shown below:
id = 1990S001, maxOcc = 2, nextT = 0 (no occurance of next or previous T after or before F)
id = 1990S005, maxOcc = 2, nextT = 0
id = 1990S014, maxOcc = 5, nextT = -8 (8th occurance of T before F)
id = 1990S019, maxOcc = 3, nextT = -2 (2nd occurance of T before F)
High appreciate your help.
Thanks time, timetable, consective occurance MATLAB Answers — New Questions
Visual3DModel In the satellite() function it doesn’t move as desired
I want to simulation the satllite by TLE using
sc = satelliteScenario(startTime,stopTime,sampleTime)
sat = satellite(sc,’example.tle’);
The code works normally. by points representing satellites moves according to the input TLE.
However, when I add
sat.Visual3DModel = "example.glb";
The model displays correctly. But when running the model The model does not move along the TLE like the previous point. and rotates in place throughout the simulation. And show the error:
Warning: Error occurred while executing the listener callback for
event MouseClickPlay defined for class
globe.internal.MouseController:
Dot indexing is not supported for variables of this type.
Error in
matlabshared.satellitescenario.internal.Satellite/addCZMLGraphic
Error in matlabshared.satellitescenario.Viewer/writeCZML
Error in satelliteScenario/play
Error in
matlabshared.satellitescenario.Viewer/resimulateCurrentScenario
Error in
matlabshared.satellitescenario.Viewer>@(~,~)viewer.resimulateCurrentScenario
Error in globe.internal.MouseController/processMouseEvent
Error in globe.internal.MouseController
Error in globe.internal.GlobeController/onRequestResponse
Error in globe.internal.GlobeController
Error in message.subscribe
Error in message.internal.executeCallback
Error in globe.internal.GlobeController
Error in globe.internal.GlobeController/waitForAction
Error in globe.internal.GlobeController/request
Error in globe.internal.GlobeController/getParameterRequest
Error in globe.internal.GlobeController/getCameraPosition
Error in globe.graphics.GeographicGlobe/getCameraPosition
Error in globe.graphics.GeographicGlobe/get.CameraPosition
Error in globe.graphics.GeographicGlobe/camheight
Error in matlabshared.satellitescenario.Viewer/camheight
Error in matlabshared.satellitescenario.ScenarioGraphic/flyToGraphic
Error in satelliteScenario/show
Error in satelliteScenario/satelliteScenarioViewer
Error in matlabshared.satellitescenario.ScenarioGraphic/show
Error in matlabshared.satellitescenario.internal.ObjectArray/show
I have tried changing several models. Every type shows the same way.
How should I fix it? Thank youI want to simulation the satllite by TLE using
sc = satelliteScenario(startTime,stopTime,sampleTime)
sat = satellite(sc,’example.tle’);
The code works normally. by points representing satellites moves according to the input TLE.
However, when I add
sat.Visual3DModel = "example.glb";
The model displays correctly. But when running the model The model does not move along the TLE like the previous point. and rotates in place throughout the simulation. And show the error:
Warning: Error occurred while executing the listener callback for
event MouseClickPlay defined for class
globe.internal.MouseController:
Dot indexing is not supported for variables of this type.
Error in
matlabshared.satellitescenario.internal.Satellite/addCZMLGraphic
Error in matlabshared.satellitescenario.Viewer/writeCZML
Error in satelliteScenario/play
Error in
matlabshared.satellitescenario.Viewer/resimulateCurrentScenario
Error in
matlabshared.satellitescenario.Viewer>@(~,~)viewer.resimulateCurrentScenario
Error in globe.internal.MouseController/processMouseEvent
Error in globe.internal.MouseController
Error in globe.internal.GlobeController/onRequestResponse
Error in globe.internal.GlobeController
Error in message.subscribe
Error in message.internal.executeCallback
Error in globe.internal.GlobeController
Error in globe.internal.GlobeController/waitForAction
Error in globe.internal.GlobeController/request
Error in globe.internal.GlobeController/getParameterRequest
Error in globe.internal.GlobeController/getCameraPosition
Error in globe.graphics.GeographicGlobe/getCameraPosition
Error in globe.graphics.GeographicGlobe/get.CameraPosition
Error in globe.graphics.GeographicGlobe/camheight
Error in matlabshared.satellitescenario.Viewer/camheight
Error in matlabshared.satellitescenario.ScenarioGraphic/flyToGraphic
Error in satelliteScenario/show
Error in satelliteScenario/satelliteScenarioViewer
Error in matlabshared.satellitescenario.ScenarioGraphic/show
Error in matlabshared.satellitescenario.internal.ObjectArray/show
I have tried changing several models. Every type shows the same way.
How should I fix it? Thank you I want to simulation the satllite by TLE using
sc = satelliteScenario(startTime,stopTime,sampleTime)
sat = satellite(sc,’example.tle’);
The code works normally. by points representing satellites moves according to the input TLE.
However, when I add
sat.Visual3DModel = "example.glb";
The model displays correctly. But when running the model The model does not move along the TLE like the previous point. and rotates in place throughout the simulation. And show the error:
Warning: Error occurred while executing the listener callback for
event MouseClickPlay defined for class
globe.internal.MouseController:
Dot indexing is not supported for variables of this type.
Error in
matlabshared.satellitescenario.internal.Satellite/addCZMLGraphic
Error in matlabshared.satellitescenario.Viewer/writeCZML
Error in satelliteScenario/play
Error in
matlabshared.satellitescenario.Viewer/resimulateCurrentScenario
Error in
matlabshared.satellitescenario.Viewer>@(~,~)viewer.resimulateCurrentScenario
Error in globe.internal.MouseController/processMouseEvent
Error in globe.internal.MouseController
Error in globe.internal.GlobeController/onRequestResponse
Error in globe.internal.GlobeController
Error in message.subscribe
Error in message.internal.executeCallback
Error in globe.internal.GlobeController
Error in globe.internal.GlobeController/waitForAction
Error in globe.internal.GlobeController/request
Error in globe.internal.GlobeController/getParameterRequest
Error in globe.internal.GlobeController/getCameraPosition
Error in globe.graphics.GeographicGlobe/getCameraPosition
Error in globe.graphics.GeographicGlobe/get.CameraPosition
Error in globe.graphics.GeographicGlobe/camheight
Error in matlabshared.satellitescenario.Viewer/camheight
Error in matlabshared.satellitescenario.ScenarioGraphic/flyToGraphic
Error in satelliteScenario/show
Error in satelliteScenario/satelliteScenarioViewer
Error in matlabshared.satellitescenario.ScenarioGraphic/show
Error in matlabshared.satellitescenario.internal.ObjectArray/show
I have tried changing several models. Every type shows the same way.
How should I fix it? Thank you matlab, simulation MATLAB Answers — New Questions
How to Solve nonlinear equations in simulink
Hello everyone, I want to define and solve a system of nonlinear equations in Simulink using the MATLAB Function block, but I encountered an error. I would like to ask, why is this happening?
Here is the code inside the MATLAB Function block:
function dx = fcn(x)
dx1=x(1)+1
dx2=2*x(2)
dx=[dx1;dx2]
endHello everyone, I want to define and solve a system of nonlinear equations in Simulink using the MATLAB Function block, but I encountered an error. I would like to ask, why is this happening?
Here is the code inside the MATLAB Function block:
function dx = fcn(x)
dx1=x(1)+1
dx2=2*x(2)
dx=[dx1;dx2]
end Hello everyone, I want to define and solve a system of nonlinear equations in Simulink using the MATLAB Function block, but I encountered an error. I would like to ask, why is this happening?
Here is the code inside the MATLAB Function block:
function dx = fcn(x)
dx1=x(1)+1
dx2=2*x(2)
dx=[dx1;dx2]
end nonlinear, simulink MATLAB Answers — New Questions
how to calculate the partial derivatives for a given function of two variable ?
How can I write code to calculate the partial derivatives a given function of two variable ?How can I write code to calculate the partial derivatives a given function of two variable ? How can I write code to calculate the partial derivatives a given function of two variable ? partial-derivatives, two-variable, partial, derivatives MATLAB Answers — New Questions
How to create a suitable statistical test for my repeated measures problem with unequal sample sizes?
dear community,
i have the following problem: I want to test differences of specific repeated measures during a pre and a post test:
my datasets has 10 subjects, each subjects did 2 tasks (called pre and post). during each task, I did repeated measurements of 5 different parameters (each set of 5 parameters were taken at the same time) over time. In addition, each pre and post measurement can be divided into two segments A and B. Now, i want to analyze the differences between pre and post on four different levels: on each of the parameters
taking parameter, I want to compare
subject wise and segement wise, e.g. Subj1, pre, A to Subj1, post, A
subjects wise only, both segments together, e.g. Subj1, pre, A+B to Subj1, post, A+B
segment-wise, but all subjects, e.g. Subj1to10, pre, A to Subj1to10, post, B
all subjects, both segements: Subj1to10, pre, A+B to Subj1to10, post, A+B
note that segments A/B and pre and post measurements do not have equal sample size, the samples are not independent and they may not be normally distributed.
How to tell, if there is a statistical significant difference between pre and post test at each of the four levels, and a suitable post-hoc analysis to tell, how this difference might be directed (probably looking at the median?)
And of course i need to compensate for mutiple comparison due to the 4 levels and the 5 parameters is measured at the same time?
best regards
Jonasdear community,
i have the following problem: I want to test differences of specific repeated measures during a pre and a post test:
my datasets has 10 subjects, each subjects did 2 tasks (called pre and post). during each task, I did repeated measurements of 5 different parameters (each set of 5 parameters were taken at the same time) over time. In addition, each pre and post measurement can be divided into two segments A and B. Now, i want to analyze the differences between pre and post on four different levels: on each of the parameters
taking parameter, I want to compare
subject wise and segement wise, e.g. Subj1, pre, A to Subj1, post, A
subjects wise only, both segments together, e.g. Subj1, pre, A+B to Subj1, post, A+B
segment-wise, but all subjects, e.g. Subj1to10, pre, A to Subj1to10, post, B
all subjects, both segements: Subj1to10, pre, A+B to Subj1to10, post, A+B
note that segments A/B and pre and post measurements do not have equal sample size, the samples are not independent and they may not be normally distributed.
How to tell, if there is a statistical significant difference between pre and post test at each of the four levels, and a suitable post-hoc analysis to tell, how this difference might be directed (probably looking at the median?)
And of course i need to compensate for mutiple comparison due to the 4 levels and the 5 parameters is measured at the same time?
best regards
Jonas dear community,
i have the following problem: I want to test differences of specific repeated measures during a pre and a post test:
my datasets has 10 subjects, each subjects did 2 tasks (called pre and post). during each task, I did repeated measurements of 5 different parameters (each set of 5 parameters were taken at the same time) over time. In addition, each pre and post measurement can be divided into two segments A and B. Now, i want to analyze the differences between pre and post on four different levels: on each of the parameters
taking parameter, I want to compare
subject wise and segement wise, e.g. Subj1, pre, A to Subj1, post, A
subjects wise only, both segments together, e.g. Subj1, pre, A+B to Subj1, post, A+B
segment-wise, but all subjects, e.g. Subj1to10, pre, A to Subj1to10, post, B
all subjects, both segements: Subj1to10, pre, A+B to Subj1to10, post, A+B
note that segments A/B and pre and post measurements do not have equal sample size, the samples are not independent and they may not be normally distributed.
How to tell, if there is a statistical significant difference between pre and post test at each of the four levels, and a suitable post-hoc analysis to tell, how this difference might be directed (probably looking at the median?)
And of course i need to compensate for mutiple comparison due to the 4 levels and the 5 parameters is measured at the same time?
best regards
Jonas statistics, repeated measures, multiple comaprisons, mixed effects MATLAB Answers — New Questions
Unable to save files in MATLAB Online
I have been using MATLAB Online for six months because I had a chromebook. This week, I got a windows, so I installed MATLAB on it. All of a sudden, my MATLAB Online has started acting weirdly. It would let me log in and run files, but it would not let me save ANYTHING. If I edit an existing script, I can’t save changes. If I create a new script, I can’t run it (because I need to save it first). If I create an image using my existing codes, I cannot export it either (because that ‘saves’ the image as a png).
I don’t think that switching my computer has anything to do with this problem, but they happened around the same time. I have doubts in my mind that this could have something to do with using the same license on both places, but I find it highly unlikely.
Any help is greatly appreciated.I have been using MATLAB Online for six months because I had a chromebook. This week, I got a windows, so I installed MATLAB on it. All of a sudden, my MATLAB Online has started acting weirdly. It would let me log in and run files, but it would not let me save ANYTHING. If I edit an existing script, I can’t save changes. If I create a new script, I can’t run it (because I need to save it first). If I create an image using my existing codes, I cannot export it either (because that ‘saves’ the image as a png).
I don’t think that switching my computer has anything to do with this problem, but they happened around the same time. I have doubts in my mind that this could have something to do with using the same license on both places, but I find it highly unlikely.
Any help is greatly appreciated. I have been using MATLAB Online for six months because I had a chromebook. This week, I got a windows, so I installed MATLAB on it. All of a sudden, my MATLAB Online has started acting weirdly. It would let me log in and run files, but it would not let me save ANYTHING. If I edit an existing script, I can’t save changes. If I create a new script, I can’t run it (because I need to save it first). If I create an image using my existing codes, I cannot export it either (because that ‘saves’ the image as a png).
I don’t think that switching my computer has anything to do with this problem, but they happened around the same time. I have doubts in my mind that this could have something to do with using the same license on both places, but I find it highly unlikely.
Any help is greatly appreciated. matlab online, license, error, file, creating file, save, matlab_online, distance_learning MATLAB Answers — New Questions
How to integrate an implicit acceleration function to a fitting pair of graphs of velocity and displacement
Hello!
New to matlab, so sorry if the question appears a bit of dumb
Im currently trying to plot the displacement of a falling pellet which acceleration follows implicit function f = @(t,a) exp((4.33254*w)/(9.81-a) – t/0.1036881 – 0.418/(0.00032*v)) – ((0.013864*v*w)/((9.81-a)*(0.418+0.00032*v)) – (0.00032*v)/(0.418+0.00032*w))
Where v and w are parameters to be adjusted.
The goal here is to first calculate the integral of the function to obtain a velocity function where the initial velocity is equal to 0 when t=0 and then obtain the integral of the velocity function to calculate the displacememt, where x=h (yet another parameter) when t=0 as well
However I struggle to find the correct sets of tools for that
Any advice is appreciated!
The deceleration graph looks somewhat like this btwHello!
New to matlab, so sorry if the question appears a bit of dumb
Im currently trying to plot the displacement of a falling pellet which acceleration follows implicit function f = @(t,a) exp((4.33254*w)/(9.81-a) – t/0.1036881 – 0.418/(0.00032*v)) – ((0.013864*v*w)/((9.81-a)*(0.418+0.00032*v)) – (0.00032*v)/(0.418+0.00032*w))
Where v and w are parameters to be adjusted.
The goal here is to first calculate the integral of the function to obtain a velocity function where the initial velocity is equal to 0 when t=0 and then obtain the integral of the velocity function to calculate the displacememt, where x=h (yet another parameter) when t=0 as well
However I struggle to find the correct sets of tools for that
Any advice is appreciated!
The deceleration graph looks somewhat like this btw Hello!
New to matlab, so sorry if the question appears a bit of dumb
Im currently trying to plot the displacement of a falling pellet which acceleration follows implicit function f = @(t,a) exp((4.33254*w)/(9.81-a) – t/0.1036881 – 0.418/(0.00032*v)) – ((0.013864*v*w)/((9.81-a)*(0.418+0.00032*v)) – (0.00032*v)/(0.418+0.00032*w))
Where v and w are parameters to be adjusted.
The goal here is to first calculate the integral of the function to obtain a velocity function where the initial velocity is equal to 0 when t=0 and then obtain the integral of the velocity function to calculate the displacememt, where x=h (yet another parameter) when t=0 as well
However I struggle to find the correct sets of tools for that
Any advice is appreciated!
The deceleration graph looks somewhat like this btw graph, function MATLAB Answers — New Questions
Algebraic Loops with FMU
When connecting FMUs in co-simulation mode in a loop an algebraic loop errors occurs, which causes termination of simulation. Therefore, I assume Simulink identifies the FMU-blocks as direct feedthrough. In the FMI 3.0 specification it is stated, that there cannot be a direct feedthough in Co-Simulation, as the step-size has to be greater that 0. Why does Simulink handle FMUs in co-simulation mode as direct feedthrough (and not like integrator blocks instead)?
Unfortunately I could not find anything regarding how the C-API functions of the FMUs are called by the Simulink discrete fixed-step solver.When connecting FMUs in co-simulation mode in a loop an algebraic loop errors occurs, which causes termination of simulation. Therefore, I assume Simulink identifies the FMU-blocks as direct feedthrough. In the FMI 3.0 specification it is stated, that there cannot be a direct feedthough in Co-Simulation, as the step-size has to be greater that 0. Why does Simulink handle FMUs in co-simulation mode as direct feedthrough (and not like integrator blocks instead)?
Unfortunately I could not find anything regarding how the C-API functions of the FMUs are called by the Simulink discrete fixed-step solver. When connecting FMUs in co-simulation mode in a loop an algebraic loop errors occurs, which causes termination of simulation. Therefore, I assume Simulink identifies the FMU-blocks as direct feedthrough. In the FMI 3.0 specification it is stated, that there cannot be a direct feedthough in Co-Simulation, as the step-size has to be greater that 0. Why does Simulink handle FMUs in co-simulation mode as direct feedthrough (and not like integrator blocks instead)?
Unfortunately I could not find anything regarding how the C-API functions of the FMUs are called by the Simulink discrete fixed-step solver. fmu, fmi, algebraic loops, discrete fixed-step solver, fmu-block MATLAB Answers — New Questions
Error using confusionchart (line 68) Order must be an exact permutation of the class labels.
Please help with this error – what could be the cause?
Error using confusionchart (line 68)
Order must be an exact permutation of the class labels.Please help with this error – what could be the cause?
Error using confusionchart (line 68)
Order must be an exact permutation of the class labels. Please help with this error – what could be the cause?
Error using confusionchart (line 68)
Order must be an exact permutation of the class labels. confusionchart MATLAB Answers — New Questions