Category: Matlab
Category Archives: Matlab
How to plot temporal representations?
Hello everybody, i hope you and everyone here can help me in plotting temporal representations of x1(t), x21(t), x22(t) and x23(t)
This code :
N = 1e3; % Number of data points
T0 = pi; % Can be any number
t = linspace(0, T0, N); % time space with N data points
f0=1000; f1=2000; f2=2000;
x1 = sin(2*pi*f0*t)+sin(2*pi*f1*t)+sin(2*pi*f2*t);
T1 =2*pi; % Can be any number
t1 = linspace(0, T1-pi/N, N); % time space with N data points
x21 = sin(2*pi*f0*t1);
T2 = 3*pi; % Can be any number
t2 = linspace(T1, T2-pi/N, N); % time space with N data points
x22 = sin(2*pi*f1*t2);
T3 = inf;
t2 = linspace(T2, T3, N);
x23 = sin(2*pi*f2*t2);Hello everybody, i hope you and everyone here can help me in plotting temporal representations of x1(t), x21(t), x22(t) and x23(t)
This code :
N = 1e3; % Number of data points
T0 = pi; % Can be any number
t = linspace(0, T0, N); % time space with N data points
f0=1000; f1=2000; f2=2000;
x1 = sin(2*pi*f0*t)+sin(2*pi*f1*t)+sin(2*pi*f2*t);
T1 =2*pi; % Can be any number
t1 = linspace(0, T1-pi/N, N); % time space with N data points
x21 = sin(2*pi*f0*t1);
T2 = 3*pi; % Can be any number
t2 = linspace(T1, T2-pi/N, N); % time space with N data points
x22 = sin(2*pi*f1*t2);
T3 = inf;
t2 = linspace(T2, T3, N);
x23 = sin(2*pi*f2*t2); Hello everybody, i hope you and everyone here can help me in plotting temporal representations of x1(t), x21(t), x22(t) and x23(t)
This code :
N = 1e3; % Number of data points
T0 = pi; % Can be any number
t = linspace(0, T0, N); % time space with N data points
f0=1000; f1=2000; f2=2000;
x1 = sin(2*pi*f0*t)+sin(2*pi*f1*t)+sin(2*pi*f2*t);
T1 =2*pi; % Can be any number
t1 = linspace(0, T1-pi/N, N); % time space with N data points
x21 = sin(2*pi*f0*t1);
T2 = 3*pi; % Can be any number
t2 = linspace(T1, T2-pi/N, N); % time space with N data points
x22 = sin(2*pi*f1*t2);
T3 = inf;
t2 = linspace(T2, T3, N);
x23 = sin(2*pi*f2*t2); tomporal domain MATLAB Answers — New Questions
Walks and eccentricity, graph theory
Hi, i have an adjacency matrix where Aij denotes the number of edges from vi to vj, edges going out from the vi gives the elements in the first row and now of the matrix and now i want to:
first, write a function exwalk(A) compute a matrix containing the number of walks between vi and vj in exactly k steps.
use exwalk(A) to create a function maxwalk(A, k) compute the number of walks in at most k steps.
write a function eccentricities(A) compute a list of ecc(v) eccentricities for all vertices.Hi, i have an adjacency matrix where Aij denotes the number of edges from vi to vj, edges going out from the vi gives the elements in the first row and now of the matrix and now i want to:
first, write a function exwalk(A) compute a matrix containing the number of walks between vi and vj in exactly k steps.
use exwalk(A) to create a function maxwalk(A, k) compute the number of walks in at most k steps.
write a function eccentricities(A) compute a list of ecc(v) eccentricities for all vertices. Hi, i have an adjacency matrix where Aij denotes the number of edges from vi to vj, edges going out from the vi gives the elements in the first row and now of the matrix and now i want to:
first, write a function exwalk(A) compute a matrix containing the number of walks between vi and vj in exactly k steps.
use exwalk(A) to create a function maxwalk(A, k) compute the number of walks in at most k steps.
write a function eccentricities(A) compute a list of ecc(v) eccentricities for all vertices. graphtheory MATLAB Answers — New Questions
How to connect a 6 DoF joint to a moving center of mass (by creating a moving frame) in Simscape Multibody
I am simulating the projectile motion of an ariel vehicle with its wing deployment in Simscape Multibody. The ariel vehicle has an initial velocity, which is provided by the State Target in 6 DoF joint. The 6DoF joint is connected to the CG location of the whole vehicle at its initial condition. During the projectile motion of the vehicle, the wing deployment occurs.
The CG location of the vehicle changes at every instant due to the wing deployment. I am measuring this distance using an Inertia Sensor. The whole process until this step works well.
My actual aim is to do a co-simulation between Simscape and a CFD solver. I created a Standalone FMU from the simscape model and provided to the CFD solver. From CFD solver I calculate the aerodynamic forces and moments based on new CG location at every time step and give as input to the simscape multibody model (FMU).
Current difficulty:
My current difficulty is on placing a joint on a moving center of mass (CG) in Simscape Multibody. In simscape, when we place a 6-DoF joint, the center of rotation is always on the joint connection point. In my case, this point is fixed at the initial CG location. Instead, I want to have a joint at the moving CG location. If I have a frame on the moving CG location, I can apply the aerodynamic forces from CFD (using 6 DoF joint) directly at that location. I tried to follow some related answers from https://www.mathworks.com/matlabcentral/answers/1576920-placing-a-joint-on-a-moving-center-of-mass-in-simscape-multibody?s_tid=answers_rc1-2_p2_MLT and https://www.mathworks.com/matlabcentral/answers/1851513-simscape-multibody-apply-forces-sense-velocity-of-global-center-of-mass to resolve this issue, but I could not succed.
I appreciate any suggestion/comment in this regard how to place a frame (joint) on a moving center of mass (CG).
Thanks.I am simulating the projectile motion of an ariel vehicle with its wing deployment in Simscape Multibody. The ariel vehicle has an initial velocity, which is provided by the State Target in 6 DoF joint. The 6DoF joint is connected to the CG location of the whole vehicle at its initial condition. During the projectile motion of the vehicle, the wing deployment occurs.
The CG location of the vehicle changes at every instant due to the wing deployment. I am measuring this distance using an Inertia Sensor. The whole process until this step works well.
My actual aim is to do a co-simulation between Simscape and a CFD solver. I created a Standalone FMU from the simscape model and provided to the CFD solver. From CFD solver I calculate the aerodynamic forces and moments based on new CG location at every time step and give as input to the simscape multibody model (FMU).
Current difficulty:
My current difficulty is on placing a joint on a moving center of mass (CG) in Simscape Multibody. In simscape, when we place a 6-DoF joint, the center of rotation is always on the joint connection point. In my case, this point is fixed at the initial CG location. Instead, I want to have a joint at the moving CG location. If I have a frame on the moving CG location, I can apply the aerodynamic forces from CFD (using 6 DoF joint) directly at that location. I tried to follow some related answers from https://www.mathworks.com/matlabcentral/answers/1576920-placing-a-joint-on-a-moving-center-of-mass-in-simscape-multibody?s_tid=answers_rc1-2_p2_MLT and https://www.mathworks.com/matlabcentral/answers/1851513-simscape-multibody-apply-forces-sense-velocity-of-global-center-of-mass to resolve this issue, but I could not succed.
I appreciate any suggestion/comment in this regard how to place a frame (joint) on a moving center of mass (CG).
Thanks. I am simulating the projectile motion of an ariel vehicle with its wing deployment in Simscape Multibody. The ariel vehicle has an initial velocity, which is provided by the State Target in 6 DoF joint. The 6DoF joint is connected to the CG location of the whole vehicle at its initial condition. During the projectile motion of the vehicle, the wing deployment occurs.
The CG location of the vehicle changes at every instant due to the wing deployment. I am measuring this distance using an Inertia Sensor. The whole process until this step works well.
My actual aim is to do a co-simulation between Simscape and a CFD solver. I created a Standalone FMU from the simscape model and provided to the CFD solver. From CFD solver I calculate the aerodynamic forces and moments based on new CG location at every time step and give as input to the simscape multibody model (FMU).
Current difficulty:
My current difficulty is on placing a joint on a moving center of mass (CG) in Simscape Multibody. In simscape, when we place a 6-DoF joint, the center of rotation is always on the joint connection point. In my case, this point is fixed at the initial CG location. Instead, I want to have a joint at the moving CG location. If I have a frame on the moving CG location, I can apply the aerodynamic forces from CFD (using 6 DoF joint) directly at that location. I tried to follow some related answers from https://www.mathworks.com/matlabcentral/answers/1576920-placing-a-joint-on-a-moving-center-of-mass-in-simscape-multibody?s_tid=answers_rc1-2_p2_MLT and https://www.mathworks.com/matlabcentral/answers/1851513-simscape-multibody-apply-forces-sense-velocity-of-global-center-of-mass to resolve this issue, but I could not succed.
I appreciate any suggestion/comment in this regard how to place a frame (joint) on a moving center of mass (CG).
Thanks. simscape, 6-dof joint, moving center of mass, moving frame, co-simulation, simscape multibody, matlab, simulink MATLAB Answers — New Questions
How to update PID after system identification with closed loop PID Autotuner?
In the literature, system identification can be performed using various techniques like RLS, ARX, ARMAX, Kalman Filter, or frequency domain methods. In quadcopter systems, PX4 uses an autotune mode with the RLS method, and after that, GMVC law is applied to find optimal PID parameters. Similarly, Simulink has a ‘Closed-loop PID autotuner’ block.
What I’m confused about is the process of updating the PID parameters after system identification, which is typically done in a closed-loop setup. For example, let’s say I have an active PID with P: 3, I: 4, D: 2.8. If we use GMVC or another method to identify new PID parameters based on the closed-loop system response, how do we update these PID values?
Directly replacing the old parameters with the new ones seems problematic because the system identification itself was based on the current closed-loop response. I’m considering that we might need to combine the old and new PID parameters into a series configuration, which implies having two different PIDs in sequence. However, this doesn’t seem ideal.
Would it make more sense to extract the transfer function of the closed-loop system, remove the contribution of the current PID, and then apply the new PID parameters based on the open-loop transfer function by adding the old ones and test?In the literature, system identification can be performed using various techniques like RLS, ARX, ARMAX, Kalman Filter, or frequency domain methods. In quadcopter systems, PX4 uses an autotune mode with the RLS method, and after that, GMVC law is applied to find optimal PID parameters. Similarly, Simulink has a ‘Closed-loop PID autotuner’ block.
What I’m confused about is the process of updating the PID parameters after system identification, which is typically done in a closed-loop setup. For example, let’s say I have an active PID with P: 3, I: 4, D: 2.8. If we use GMVC or another method to identify new PID parameters based on the closed-loop system response, how do we update these PID values?
Directly replacing the old parameters with the new ones seems problematic because the system identification itself was based on the current closed-loop response. I’m considering that we might need to combine the old and new PID parameters into a series configuration, which implies having two different PIDs in sequence. However, this doesn’t seem ideal.
Would it make more sense to extract the transfer function of the closed-loop system, remove the contribution of the current PID, and then apply the new PID parameters based on the open-loop transfer function by adding the old ones and test? In the literature, system identification can be performed using various techniques like RLS, ARX, ARMAX, Kalman Filter, or frequency domain methods. In quadcopter systems, PX4 uses an autotune mode with the RLS method, and after that, GMVC law is applied to find optimal PID parameters. Similarly, Simulink has a ‘Closed-loop PID autotuner’ block.
What I’m confused about is the process of updating the PID parameters after system identification, which is typically done in a closed-loop setup. For example, let’s say I have an active PID with P: 3, I: 4, D: 2.8. If we use GMVC or another method to identify new PID parameters based on the closed-loop system response, how do we update these PID values?
Directly replacing the old parameters with the new ones seems problematic because the system identification itself was based on the current closed-loop response. I’m considering that we might need to combine the old and new PID parameters into a series configuration, which implies having two different PIDs in sequence. However, this doesn’t seem ideal.
Would it make more sense to extract the transfer function of the closed-loop system, remove the contribution of the current PID, and then apply the new PID parameters based on the open-loop transfer function by adding the old ones and test? systemidentification, pid, transfer function MATLAB Answers — New Questions
How to implement the linear output function in Takagi–Sugeno Fuzzy System?
hi, i want to implement Takagi Sugeno model in matlab using FIS, how can i set this rule:
"if x is large and y is small, then z=x+y+2"
of course i can add "If (x is large) and (y is small) then (Z is ‘…’)", but i cannot add "x+y+2", how can i do it?
thanks so muchhi, i want to implement Takagi Sugeno model in matlab using FIS, how can i set this rule:
"if x is large and y is small, then z=x+y+2"
of course i can add "If (x is large) and (y is small) then (Z is ‘…’)", but i cannot add "x+y+2", how can i do it?
thanks so much hi, i want to implement Takagi Sugeno model in matlab using FIS, how can i set this rule:
"if x is large and y is small, then z=x+y+2"
of course i can add "If (x is large) and (y is small) then (Z is ‘…’)", but i cannot add "x+y+2", how can i do it?
thanks so much implement sugeno in fis MATLAB Answers — New Questions
Cannot locate a valid install area
Hello
I’m trying to run an app on MAC, the app was built in Matlab and MCR (Matlab runtime) is required. I went ahead and installed Matlab_Runtime_R2021a_maci64 and I’m getting the following error:
Do you have any idea? any advise on how to fix this problem?
Thanks,Hello
I’m trying to run an app on MAC, the app was built in Matlab and MCR (Matlab runtime) is required. I went ahead and installed Matlab_Runtime_R2021a_maci64 and I’m getting the following error:
Do you have any idea? any advise on how to fix this problem?
Thanks, Hello
I’m trying to run an app on MAC, the app was built in Matlab and MCR (Matlab runtime) is required. I went ahead and installed Matlab_Runtime_R2021a_maci64 and I’m getting the following error:
Do you have any idea? any advise on how to fix this problem?
Thanks, mcr, valid install area MATLAB Answers — New Questions
coupled differntial equation using ode45
I’m getting an error while solving this coupled differential equation usually the error is showing issues with vertical concatenation. here’s the equation i’m tring to solve with mu0 = exp(-T0) and Boundary conditions as : U(y = -1) = 0 and U(y= 1) = 0 and T0 = 0 at y = -1 and T0 = 1 at y = 1.
here’s my code:
% Main script to solve the velocity and temperature profile
clear;
clc;
% Define constants
G = 1; % Source term (example value)
Na = 1; % Nusselt number (example value)
% Define the domain for y
y_span = [-1 1];
%% Step 1: Solve Velocity Equation to get U and dU/dy
% The velocity equation is:
% d/dy (mu0 * dU/dy) = G
% Define the velocity equation as a system of two first-order ODEs
function dU = velocity_ode(y, U, mu0, G)
dU = [U(2); (1/mu0) * G]; % U(1) = U, U(2) = dU/dy
end
% Initial conditions for velocity at y = -1
U_initial = [0; 0]; % U = 0 and dU/dy = 0 at y = -1 (you can adjust this)
% Solve the velocity equation using ode45
[y_vel, U_sol] = ode45(@(y, U) velocity_ode(y, U, mu0, G), y_span, U_initial);
% Extract dU/dy from the solution
dU_dy = U_sol(:, 2); % This is the derivative of U with respect to y
% Plot the velocity profile and its derivative
figure;
subplot(2,1,1);
plot(y_vel, U_sol(:, 1), ‘b-‘, ‘LineWidth’, 2); % U(y)
xlabel(‘y’);
ylabel(‘U(y)’);
title(‘Velocity Profile’);
subplot(2,1,2);
plot(y_vel, dU_dy, ‘r-‘, ‘LineWidth’, 2); % dU/dy(y)
xlabel(‘y’);
ylabel(‘dU/dy’);
title(‘Velocity Gradient Profile’);
%% Step 2: Solve Temperature Equation using dU/dy from Step 1
% Temperature equation: d^2T0/dy^2 + Na * mu0 * (dU/dy)^2 = 0
% Define the temperature equation as a system of two first-order ODEs
function dT = temperature_ode(y, T, dU_dy, mu0, Na)
dT = zeros(2,1); % Initialize the output vector
% Interpolate dU/dy from the previously computed solution
dUdy_squared = interp1(y_vel, dU_dy.^2, y, ‘linear’, ‘extrap’);
% First equation: dT0/dy = T(2)
dT(1) = T(2);
% Second equation: d^2T0/dy^2 = -Na * mu0 * (dU/dy)^2
dT(2) = -Na * mu0 * dUdy_squared;
end
% Initial conditions for temperature at y = -1
T0_initial = [0; 0]; % T0 = 0 and dT0/dy = 0 at y = -1 (adjust second value if needed)
mu0 = ex(-T0); % Viscosity (example value)
% Solve the temperature equation using ode45
[y_temp, T_sol] = ode45(@(y, T) temperature_ode(y, T, dU_dy, mu0, Na), y_span, T0_initial);
% Plot the temperature profile
figure;
plot(y_temp, T_sol(:, 1), ‘r-‘, ‘LineWidth’, 2); % T0
xlabel(‘y’);
ylabel(‘T_0(y)’);
title(‘Temperature Profile’);
Please help me here, thanks in advanceI’m getting an error while solving this coupled differential equation usually the error is showing issues with vertical concatenation. here’s the equation i’m tring to solve with mu0 = exp(-T0) and Boundary conditions as : U(y = -1) = 0 and U(y= 1) = 0 and T0 = 0 at y = -1 and T0 = 1 at y = 1.
here’s my code:
% Main script to solve the velocity and temperature profile
clear;
clc;
% Define constants
G = 1; % Source term (example value)
Na = 1; % Nusselt number (example value)
% Define the domain for y
y_span = [-1 1];
%% Step 1: Solve Velocity Equation to get U and dU/dy
% The velocity equation is:
% d/dy (mu0 * dU/dy) = G
% Define the velocity equation as a system of two first-order ODEs
function dU = velocity_ode(y, U, mu0, G)
dU = [U(2); (1/mu0) * G]; % U(1) = U, U(2) = dU/dy
end
% Initial conditions for velocity at y = -1
U_initial = [0; 0]; % U = 0 and dU/dy = 0 at y = -1 (you can adjust this)
% Solve the velocity equation using ode45
[y_vel, U_sol] = ode45(@(y, U) velocity_ode(y, U, mu0, G), y_span, U_initial);
% Extract dU/dy from the solution
dU_dy = U_sol(:, 2); % This is the derivative of U with respect to y
% Plot the velocity profile and its derivative
figure;
subplot(2,1,1);
plot(y_vel, U_sol(:, 1), ‘b-‘, ‘LineWidth’, 2); % U(y)
xlabel(‘y’);
ylabel(‘U(y)’);
title(‘Velocity Profile’);
subplot(2,1,2);
plot(y_vel, dU_dy, ‘r-‘, ‘LineWidth’, 2); % dU/dy(y)
xlabel(‘y’);
ylabel(‘dU/dy’);
title(‘Velocity Gradient Profile’);
%% Step 2: Solve Temperature Equation using dU/dy from Step 1
% Temperature equation: d^2T0/dy^2 + Na * mu0 * (dU/dy)^2 = 0
% Define the temperature equation as a system of two first-order ODEs
function dT = temperature_ode(y, T, dU_dy, mu0, Na)
dT = zeros(2,1); % Initialize the output vector
% Interpolate dU/dy from the previously computed solution
dUdy_squared = interp1(y_vel, dU_dy.^2, y, ‘linear’, ‘extrap’);
% First equation: dT0/dy = T(2)
dT(1) = T(2);
% Second equation: d^2T0/dy^2 = -Na * mu0 * (dU/dy)^2
dT(2) = -Na * mu0 * dUdy_squared;
end
% Initial conditions for temperature at y = -1
T0_initial = [0; 0]; % T0 = 0 and dT0/dy = 0 at y = -1 (adjust second value if needed)
mu0 = ex(-T0); % Viscosity (example value)
% Solve the temperature equation using ode45
[y_temp, T_sol] = ode45(@(y, T) temperature_ode(y, T, dU_dy, mu0, Na), y_span, T0_initial);
% Plot the temperature profile
figure;
plot(y_temp, T_sol(:, 1), ‘r-‘, ‘LineWidth’, 2); % T0
xlabel(‘y’);
ylabel(‘T_0(y)’);
title(‘Temperature Profile’);
Please help me here, thanks in advance I’m getting an error while solving this coupled differential equation usually the error is showing issues with vertical concatenation. here’s the equation i’m tring to solve with mu0 = exp(-T0) and Boundary conditions as : U(y = -1) = 0 and U(y= 1) = 0 and T0 = 0 at y = -1 and T0 = 1 at y = 1.
here’s my code:
% Main script to solve the velocity and temperature profile
clear;
clc;
% Define constants
G = 1; % Source term (example value)
Na = 1; % Nusselt number (example value)
% Define the domain for y
y_span = [-1 1];
%% Step 1: Solve Velocity Equation to get U and dU/dy
% The velocity equation is:
% d/dy (mu0 * dU/dy) = G
% Define the velocity equation as a system of two first-order ODEs
function dU = velocity_ode(y, U, mu0, G)
dU = [U(2); (1/mu0) * G]; % U(1) = U, U(2) = dU/dy
end
% Initial conditions for velocity at y = -1
U_initial = [0; 0]; % U = 0 and dU/dy = 0 at y = -1 (you can adjust this)
% Solve the velocity equation using ode45
[y_vel, U_sol] = ode45(@(y, U) velocity_ode(y, U, mu0, G), y_span, U_initial);
% Extract dU/dy from the solution
dU_dy = U_sol(:, 2); % This is the derivative of U with respect to y
% Plot the velocity profile and its derivative
figure;
subplot(2,1,1);
plot(y_vel, U_sol(:, 1), ‘b-‘, ‘LineWidth’, 2); % U(y)
xlabel(‘y’);
ylabel(‘U(y)’);
title(‘Velocity Profile’);
subplot(2,1,2);
plot(y_vel, dU_dy, ‘r-‘, ‘LineWidth’, 2); % dU/dy(y)
xlabel(‘y’);
ylabel(‘dU/dy’);
title(‘Velocity Gradient Profile’);
%% Step 2: Solve Temperature Equation using dU/dy from Step 1
% Temperature equation: d^2T0/dy^2 + Na * mu0 * (dU/dy)^2 = 0
% Define the temperature equation as a system of two first-order ODEs
function dT = temperature_ode(y, T, dU_dy, mu0, Na)
dT = zeros(2,1); % Initialize the output vector
% Interpolate dU/dy from the previously computed solution
dUdy_squared = interp1(y_vel, dU_dy.^2, y, ‘linear’, ‘extrap’);
% First equation: dT0/dy = T(2)
dT(1) = T(2);
% Second equation: d^2T0/dy^2 = -Na * mu0 * (dU/dy)^2
dT(2) = -Na * mu0 * dUdy_squared;
end
% Initial conditions for temperature at y = -1
T0_initial = [0; 0]; % T0 = 0 and dT0/dy = 0 at y = -1 (adjust second value if needed)
mu0 = ex(-T0); % Viscosity (example value)
% Solve the temperature equation using ode45
[y_temp, T_sol] = ode45(@(y, T) temperature_ode(y, T, dU_dy, mu0, Na), y_span, T0_initial);
% Plot the temperature profile
figure;
plot(y_temp, T_sol(:, 1), ‘r-‘, ‘LineWidth’, 2); % T0
xlabel(‘y’);
ylabel(‘T_0(y)’);
title(‘Temperature Profile’);
Please help me here, thanks in advance ode45, matlab, coupledode MATLAB Answers — New Questions
Solve a complex differential equations system
I need to write a script that can solve the system of differential equation written in this article.
Thank you to everyone who will try to help me:)I need to write a script that can solve the system of differential equation written in this article.
Thank you to everyone who will try to help me:) I need to write a script that can solve the system of differential equation written in this article.
Thank you to everyone who will try to help me:) differential equations MATLAB Answers — New Questions
Error importing matlab.engine in python
I am getting the following error when I type import matlab.engine in python IDLE
Traceback (most recent call last):
File "C:UsersudvasAppDataLocalProgramsPythonPython37libsite-packagesmatlabengine__init__.py", line 45, in <module>
pythonengine = importlib.import_module("matlabengineforpython"+_PYTHONVERSION)
File "C:UsersudvasAppDataLocalProgramsPythonPython37libimportlib__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named ‘matlabengineforpython3_7’
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:UsersudvasAppDataLocalProgramsPythonPython37libsite-packagesmatlabengine__init__.py", line 61, in <module>
pythonengine = importlib.import_module("matlabengineforpython"+_PYTHONVERSION)
File "C:UsersudvasAppDataLocalProgramsPythonPython37libimportlib__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 670, in _load_unlocked
File "<frozen importlib._bootstrap>", line 583, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 1043, in create_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
ImportError: DLL load failed: The specified procedure could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
import matlab.engine
File "C:UsersudvasAppDataLocalProgramsPythonPython37libsite-packagesmatlabengine__init__.py", line 64, in <module>
‘MathWorks Technical Support for assistance: %s’ % e)
OSError: Please reinstall MATLAB Engine for Python or contact MathWorks Technical Support for assistance: DLL load failed: The specified procedure could not be found.
I am using Matlab 2020a and python 3.7.1.I am getting the following error when I type import matlab.engine in python IDLE
Traceback (most recent call last):
File "C:UsersudvasAppDataLocalProgramsPythonPython37libsite-packagesmatlabengine__init__.py", line 45, in <module>
pythonengine = importlib.import_module("matlabengineforpython"+_PYTHONVERSION)
File "C:UsersudvasAppDataLocalProgramsPythonPython37libimportlib__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named ‘matlabengineforpython3_7’
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:UsersudvasAppDataLocalProgramsPythonPython37libsite-packagesmatlabengine__init__.py", line 61, in <module>
pythonengine = importlib.import_module("matlabengineforpython"+_PYTHONVERSION)
File "C:UsersudvasAppDataLocalProgramsPythonPython37libimportlib__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 670, in _load_unlocked
File "<frozen importlib._bootstrap>", line 583, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 1043, in create_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
ImportError: DLL load failed: The specified procedure could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
import matlab.engine
File "C:UsersudvasAppDataLocalProgramsPythonPython37libsite-packagesmatlabengine__init__.py", line 64, in <module>
‘MathWorks Technical Support for assistance: %s’ % e)
OSError: Please reinstall MATLAB Engine for Python or contact MathWorks Technical Support for assistance: DLL load failed: The specified procedure could not be found.
I am using Matlab 2020a and python 3.7.1. I am getting the following error when I type import matlab.engine in python IDLE
Traceback (most recent call last):
File "C:UsersudvasAppDataLocalProgramsPythonPython37libsite-packagesmatlabengine__init__.py", line 45, in <module>
pythonengine = importlib.import_module("matlabengineforpython"+_PYTHONVERSION)
File "C:UsersudvasAppDataLocalProgramsPythonPython37libimportlib__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named ‘matlabengineforpython3_7’
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:UsersudvasAppDataLocalProgramsPythonPython37libsite-packagesmatlabengine__init__.py", line 61, in <module>
pythonengine = importlib.import_module("matlabengineforpython"+_PYTHONVERSION)
File "C:UsersudvasAppDataLocalProgramsPythonPython37libimportlib__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 670, in _load_unlocked
File "<frozen importlib._bootstrap>", line 583, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 1043, in create_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
ImportError: DLL load failed: The specified procedure could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
import matlab.engine
File "C:UsersudvasAppDataLocalProgramsPythonPython37libsite-packagesmatlabengine__init__.py", line 64, in <module>
‘MathWorks Technical Support for assistance: %s’ % e)
OSError: Please reinstall MATLAB Engine for Python or contact MathWorks Technical Support for assistance: DLL load failed: The specified procedure could not be found.
I am using Matlab 2020a and python 3.7.1. python, engine MATLAB Answers — New Questions
Why do I receive error 5201 – Unable to connect with required Mathworks Services
Whenever I try to run MATLAB software, it displays the error message, ‘Unable to connect with required Mathworks Services(error 5201)
I’ve seen similar solutions on here, but the descriptions don’t seem the same.Whenever I try to run MATLAB software, it displays the error message, ‘Unable to connect with required Mathworks Services(error 5201)
I’ve seen similar solutions on here, but the descriptions don’t seem the same. Whenever I try to run MATLAB software, it displays the error message, ‘Unable to connect with required Mathworks Services(error 5201)
I’ve seen similar solutions on here, but the descriptions don’t seem the same. error 5201 MATLAB Answers — New Questions
Setup/Configure a DSN-less database without the Database Toolbox GUI MATLAB R2018b
Please how do I setup a DSN-less database connection without using the Database Toolbox GUI on MATLAB R2018b?Please how do I setup a DSN-less database connection without using the Database Toolbox GUI on MATLAB R2018b? Please how do I setup a DSN-less database connection without using the Database Toolbox GUI on MATLAB R2018b? dsn-less, sql server MATLAB Answers — New Questions
The code returns a value in the form of “theta_3b(x, z) =.”. How can I get this to return just theta_3b=
syms f g x y z
% % % % % Temperature Formula 3b % % % % %
theta_3b=0;
for n=0:25
t=0;
beta6 = (n*pi)/H;
eta6 = (((2*pi)/L)*(n+0.5));
mew6 = -1036;
lamda6 = (beta6.^2)+(eta6.^2)+(mew6.^2);
f(x,y,z) = sin(beta6*z).*cos(eta6*x).*sin(mew6*y).*cos(mew6*y);
C_nmp_numerator6 = int(int(int(f,z,[0 H]),y,[0 W]),x,[0 (L/2)]);
g(x,y,z) = ((cos(mew6*y)^2).*sin(mew6*y) – ((h/(k*mew6)).*(sin(mew6*y)^2).*cos(mew6*y)));
C_nmp_denominator6 = ((L*H)/8)* (int(g,y,[0 W]));
C_nmp6 = C_nmp_numerator6/C_nmp_denominator6;
theta_3b = theta_3b+(C_nmp6*(sin(beta6*z)*cos(eta6*x)*((cos(mew6*y)-(h/(k*mew6))*sin(mew6*y)))*exp(-(lamda6^2)*alpha*t)));
end
theta_3b = vpa(subs(theta_3b, {x,y,z}, {X,Y,Z}))syms f g x y z
% % % % % Temperature Formula 3b % % % % %
theta_3b=0;
for n=0:25
t=0;
beta6 = (n*pi)/H;
eta6 = (((2*pi)/L)*(n+0.5));
mew6 = -1036;
lamda6 = (beta6.^2)+(eta6.^2)+(mew6.^2);
f(x,y,z) = sin(beta6*z).*cos(eta6*x).*sin(mew6*y).*cos(mew6*y);
C_nmp_numerator6 = int(int(int(f,z,[0 H]),y,[0 W]),x,[0 (L/2)]);
g(x,y,z) = ((cos(mew6*y)^2).*sin(mew6*y) – ((h/(k*mew6)).*(sin(mew6*y)^2).*cos(mew6*y)));
C_nmp_denominator6 = ((L*H)/8)* (int(g,y,[0 W]));
C_nmp6 = C_nmp_numerator6/C_nmp_denominator6;
theta_3b = theta_3b+(C_nmp6*(sin(beta6*z)*cos(eta6*x)*((cos(mew6*y)-(h/(k*mew6))*sin(mew6*y)))*exp(-(lamda6^2)*alpha*t)));
end
theta_3b = vpa(subs(theta_3b, {x,y,z}, {X,Y,Z})) syms f g x y z
% % % % % Temperature Formula 3b % % % % %
theta_3b=0;
for n=0:25
t=0;
beta6 = (n*pi)/H;
eta6 = (((2*pi)/L)*(n+0.5));
mew6 = -1036;
lamda6 = (beta6.^2)+(eta6.^2)+(mew6.^2);
f(x,y,z) = sin(beta6*z).*cos(eta6*x).*sin(mew6*y).*cos(mew6*y);
C_nmp_numerator6 = int(int(int(f,z,[0 H]),y,[0 W]),x,[0 (L/2)]);
g(x,y,z) = ((cos(mew6*y)^2).*sin(mew6*y) – ((h/(k*mew6)).*(sin(mew6*y)^2).*cos(mew6*y)));
C_nmp_denominator6 = ((L*H)/8)* (int(g,y,[0 W]));
C_nmp6 = C_nmp_numerator6/C_nmp_denominator6;
theta_3b = theta_3b+(C_nmp6*(sin(beta6*z)*cos(eta6*x)*((cos(mew6*y)-(h/(k*mew6))*sin(mew6*y)))*exp(-(lamda6^2)*alpha*t)));
end
theta_3b = vpa(subs(theta_3b, {x,y,z}, {X,Y,Z})) vpa MATLAB Answers — New Questions
Convert string to 256 Characters
How to create the Matlab source text which will be equivalent to this Fortran text? The character variable must be 256 characterts long
Character*256 TEXT
TEXT = ‘Unformatted Data Version=’
Print*, TEXT
END
Thanks!How to create the Matlab source text which will be equivalent to this Fortran text? The character variable must be 256 characterts long
Character*256 TEXT
TEXT = ‘Unformatted Data Version=’
Print*, TEXT
END
Thanks! How to create the Matlab source text which will be equivalent to this Fortran text? The character variable must be 256 characterts long
Character*256 TEXT
TEXT = ‘Unformatted Data Version=’
Print*, TEXT
END
Thanks! 256 characters, string, fortran MATLAB Answers — New Questions
How to take negative of the neural network function for maximization?
I have created a neural network in matlab using the nntool and now I using the trained neural network as a fitness function for my genetic algorithm to maximize the output of my function given 3 input variables. Optimization in matlab is by default used for minimization but as i want to maximize my function i understand that I need to take negative of the function but I am not able to take a negative of the neural network function as we do for normal functions.I have created a neural network in matlab using the nntool and now I using the trained neural network as a fitness function for my genetic algorithm to maximize the output of my function given 3 input variables. Optimization in matlab is by default used for minimization but as i want to maximize my function i understand that I need to take negative of the function but I am not able to take a negative of the neural network function as we do for normal functions. I have created a neural network in matlab using the nntool and now I using the trained neural network as a fitness function for my genetic algorithm to maximize the output of my function given 3 input variables. Optimization in matlab is by default used for minimization but as i want to maximize my function i understand that I need to take negative of the function but I am not able to take a negative of the neural network function as we do for normal functions. genetic algorithm, neural network, optimization, functions, ga, matlab MATLAB Answers — New Questions
Applying weighted regression for Parameter estimation in Simulink
Hello everybody,
I am dealing with parameter estimation in Simulink with 3 measured outputs (y1, y2, y3) that have different weights on my model. It is not rational to simply introduce all the outputs with similar impact on the fitting process. How may I use a weighted objective function in the parameter estimation process in Simulink?
I appreciate any other recommendation to have relaible parameter estimation process.
Thanks in advance.
Kourosh.Hello everybody,
I am dealing with parameter estimation in Simulink with 3 measured outputs (y1, y2, y3) that have different weights on my model. It is not rational to simply introduce all the outputs with similar impact on the fitting process. How may I use a weighted objective function in the parameter estimation process in Simulink?
I appreciate any other recommendation to have relaible parameter estimation process.
Thanks in advance.
Kourosh. Hello everybody,
I am dealing with parameter estimation in Simulink with 3 measured outputs (y1, y2, y3) that have different weights on my model. It is not rational to simply introduce all the outputs with similar impact on the fitting process. How may I use a weighted objective function in the parameter estimation process in Simulink?
I appreciate any other recommendation to have relaible parameter estimation process.
Thanks in advance.
Kourosh. weighted regression, parameter estimation MATLAB Answers — New Questions
How to conduct Friedman test to compare metaheuristics and which data sets I should consider?
Dear all,
I am working on metaheuristics. I want to do Friedman test to compare the algorithms. I run each algorithm 32 times and stored the best, mean, median values from each run.
To perform the Friedman test which values I should consider, the best value (last value) from 32 runs of each algorithm, or median or mean values? and please explain the reason for selection of this particle values.
Please share your view about this test.
ThanksDear all,
I am working on metaheuristics. I want to do Friedman test to compare the algorithms. I run each algorithm 32 times and stored the best, mean, median values from each run.
To perform the Friedman test which values I should consider, the best value (last value) from 32 runs of each algorithm, or median or mean values? and please explain the reason for selection of this particle values.
Please share your view about this test.
Thanks Dear all,
I am working on metaheuristics. I want to do Friedman test to compare the algorithms. I run each algorithm 32 times and stored the best, mean, median values from each run.
To perform the Friedman test which values I should consider, the best value (last value) from 32 runs of each algorithm, or median or mean values? and please explain the reason for selection of this particle values.
Please share your view about this test.
Thanks metaheuristics, optimization, friedman test MATLAB Answers — New Questions
Machine learning model (neural network or SVM) for unequal feature matrices size
I have feature matrices obtained from visual bags of words model for various dictionary sizes. Example, Nx5, Nx10, …., Nx15000. Where N is the number of samples and 5, 10, …15000 are the visual vocabulary or dictionary size or feature vectors size. There are classification labels for each samples. There are 13 methods (SIFT, SURF, BRISK and others) to extract the feature descriptors which are eventually used in visual bags of words to encode the images to obtain the feature vector. Also, there are 13 different dictionary sizes 5, 10 to 15000.
If I had only one method and one visual vocabulary, I could have created one multi class classifier. But, here I have for 13 methods and for each of them there are 13 visual vocabulary sizes. Thus, making 169 classifiers if I want to try to train machine learning models individually. This makes things cumbersome to present.
So I would like to ask you if there is some method where I can combine these unequal Nx5, Nx10, …., Nx15000 feature matrices to have one classifier model for each 13 different feature descriptors, instead of having 169 classifiers.
Please let me know if you have any suggestions.I have feature matrices obtained from visual bags of words model for various dictionary sizes. Example, Nx5, Nx10, …., Nx15000. Where N is the number of samples and 5, 10, …15000 are the visual vocabulary or dictionary size or feature vectors size. There are classification labels for each samples. There are 13 methods (SIFT, SURF, BRISK and others) to extract the feature descriptors which are eventually used in visual bags of words to encode the images to obtain the feature vector. Also, there are 13 different dictionary sizes 5, 10 to 15000.
If I had only one method and one visual vocabulary, I could have created one multi class classifier. But, here I have for 13 methods and for each of them there are 13 visual vocabulary sizes. Thus, making 169 classifiers if I want to try to train machine learning models individually. This makes things cumbersome to present.
So I would like to ask you if there is some method where I can combine these unequal Nx5, Nx10, …., Nx15000 feature matrices to have one classifier model for each 13 different feature descriptors, instead of having 169 classifiers.
Please let me know if you have any suggestions. I have feature matrices obtained from visual bags of words model for various dictionary sizes. Example, Nx5, Nx10, …., Nx15000. Where N is the number of samples and 5, 10, …15000 are the visual vocabulary or dictionary size or feature vectors size. There are classification labels for each samples. There are 13 methods (SIFT, SURF, BRISK and others) to extract the feature descriptors which are eventually used in visual bags of words to encode the images to obtain the feature vector. Also, there are 13 different dictionary sizes 5, 10 to 15000.
If I had only one method and one visual vocabulary, I could have created one multi class classifier. But, here I have for 13 methods and for each of them there are 13 visual vocabulary sizes. Thus, making 169 classifiers if I want to try to train machine learning models individually. This makes things cumbersome to present.
So I would like to ask you if there is some method where I can combine these unequal Nx5, Nx10, …., Nx15000 feature matrices to have one classifier model for each 13 different feature descriptors, instead of having 169 classifiers.
Please let me know if you have any suggestions. computer vision, visual bags of words, feature matrices of unequal size, neural network MATLAB Answers — New Questions
How to position all the plots in app designer using matlab
Hello all, I have created an app, Let me give brief details about it. The app starts with giving number of classes edit field and a enter button. If I give Number of classes as 2, a tab group with 2 tabs will open. In each tab there will be option like click to enter input parameters. After clicking that button, Classroom number label with its editfield and enter button appears. After giving Classroom number as 402 and click enter, Number of columns editfield with enter button will appear. After enterings number of columns in classroom as 4 and click enter, those many input boxes will generate with enter button. After giving strength of each input column as 25,35,42,18 and click enter. Number of benches for each column label and based on the columns input that many input boxes for the benches also generates along with enter button. After entering the benches value in each input box as 3,4,5 and click enter. Import excel buttons are generated based on the input given in the number of benches for each column. after clicking, import excel buttons the plots related to the excel files will be generated in the tab. But the number of plots are generated based on the number of columns value. But it should generate based on the number of benches in each column. I’m attaching my app file to this question. Please help me to resolve this issue.Hello all, I have created an app, Let me give brief details about it. The app starts with giving number of classes edit field and a enter button. If I give Number of classes as 2, a tab group with 2 tabs will open. In each tab there will be option like click to enter input parameters. After clicking that button, Classroom number label with its editfield and enter button appears. After giving Classroom number as 402 and click enter, Number of columns editfield with enter button will appear. After enterings number of columns in classroom as 4 and click enter, those many input boxes will generate with enter button. After giving strength of each input column as 25,35,42,18 and click enter. Number of benches for each column label and based on the columns input that many input boxes for the benches also generates along with enter button. After entering the benches value in each input box as 3,4,5 and click enter. Import excel buttons are generated based on the input given in the number of benches for each column. after clicking, import excel buttons the plots related to the excel files will be generated in the tab. But the number of plots are generated based on the number of columns value. But it should generate based on the number of benches in each column. I’m attaching my app file to this question. Please help me to resolve this issue. Hello all, I have created an app, Let me give brief details about it. The app starts with giving number of classes edit field and a enter button. If I give Number of classes as 2, a tab group with 2 tabs will open. In each tab there will be option like click to enter input parameters. After clicking that button, Classroom number label with its editfield and enter button appears. After giving Classroom number as 402 and click enter, Number of columns editfield with enter button will appear. After enterings number of columns in classroom as 4 and click enter, those many input boxes will generate with enter button. After giving strength of each input column as 25,35,42,18 and click enter. Number of benches for each column label and based on the columns input that many input boxes for the benches also generates along with enter button. After entering the benches value in each input box as 3,4,5 and click enter. Import excel buttons are generated based on the input given in the number of benches for each column. after clicking, import excel buttons the plots related to the excel files will be generated in the tab. But the number of plots are generated based on the number of columns value. But it should generate based on the number of benches in each column. I’m attaching my app file to this question. Please help me to resolve this issue. matlab, appdesigner, matlab code MATLAB Answers — New Questions
Apply 2D Gabor wavelet in Images
Hi
I want to apply 2D Gabor filter on images at four orientations (0, 45, 90, 135 degrees). The output for every pixel should be like a vector [m0 m45 m90 m135], where m is the magnitude of orientation at that angle. Can anyone help me with the code?Hi
I want to apply 2D Gabor filter on images at four orientations (0, 45, 90, 135 degrees). The output for every pixel should be like a vector [m0 m45 m90 m135], where m is the magnitude of orientation at that angle. Can anyone help me with the code? Hi
I want to apply 2D Gabor filter on images at four orientations (0, 45, 90, 135 degrees). The output for every pixel should be like a vector [m0 m45 m90 m135], where m is the magnitude of orientation at that angle. Can anyone help me with the code? image processing, gabor wavelet, texture, texture analysis MATLAB Answers — New Questions
The backbone of deeplabv3+ returned by deeplabv3plusLayers() using augument “xeption” only support “Xception-41” network architecture?
Inside the source code of function "deeplabv3plusLayer()" with augument "xception" , it appears to use function "xception()" return a pretrained "Xception-41" as the backbone of semantic segmentation network architecture. Can you provide the support for "Xception-65 and Xception71" as the backbone of deeplabv3+ networks?Inside the source code of function "deeplabv3plusLayer()" with augument "xception" , it appears to use function "xception()" return a pretrained "Xception-41" as the backbone of semantic segmentation network architecture. Can you provide the support for "Xception-65 and Xception71" as the backbone of deeplabv3+ networks? Inside the source code of function "deeplabv3plusLayer()" with augument "xception" , it appears to use function "xception()" return a pretrained "Xception-41" as the backbone of semantic segmentation network architecture. Can you provide the support for "Xception-65 and Xception71" as the backbone of deeplabv3+ networks? deeplabv3+ MATLAB Answers — New Questions