## Category: Matlab

### Category Archives: Matlab

## I am having trouble building PX4 Hardware

I am trying to setup UAV Toolbox Support Package for PX4 Autopilots and in the build step, I am recieving this error message:

BUILDSTARTING_04-Oct-2024_20-39-58

CMAKE Config selected : px4_fmu-v3_default

your 131072×1 screen size is bogus. expect trouble

/bin/sh: 1: cmake: Permission denied

/bin/sh: 1: cmake: Permission denied

make: *** [Makefile:227: px4_fmu-v3_default] Error 127

I have successfully completed cloning PX4-Autopilot inside home directory and also completed other steps as well. But couldn’t figure it out what is the problem.I am trying to setup UAV Toolbox Support Package for PX4 Autopilots and in the build step, I am recieving this error message:

BUILDSTARTING_04-Oct-2024_20-39-58

CMAKE Config selected : px4_fmu-v3_default

your 131072×1 screen size is bogus. expect trouble

/bin/sh: 1: cmake: Permission denied

/bin/sh: 1: cmake: Permission denied

make: *** [Makefile:227: px4_fmu-v3_default] Error 127

I have successfully completed cloning PX4-Autopilot inside home directory and also completed other steps as well. But couldn’t figure it out what is the problem. I am trying to setup UAV Toolbox Support Package for PX4 Autopilots and in the build step, I am recieving this error message:

BUILDSTARTING_04-Oct-2024_20-39-58

CMAKE Config selected : px4_fmu-v3_default

your 131072×1 screen size is bogus. expect trouble

/bin/sh: 1: cmake: Permission denied

/bin/sh: 1: cmake: Permission denied

make: *** [Makefile:227: px4_fmu-v3_default] Error 127

I have successfully completed cloning PX4-Autopilot inside home directory and also completed other steps as well. But couldn’t figure it out what is the problem. uav tools, uav toolbox support package for px4 autopilots, px4 MATLAB Answers — New Questions

## problem with python numpy

I have started to try to use python functionality in matlab. The <https://ch.mathworks.com/help/matlab/matlab_external/create-object-from-python-class.html Textwrapper> example works. I now tried other packages, and everytime there is some dependency on numpy I get this message:

>> py.help(‘numpy’)

problem in numpy – ImportError:

Importing the multiarray numpy extension module failed. Most

likely you are trying to import a failed build of numpy.

If you’re working with a numpy git repo, try `git clean -xdf` (removes all

files not under version control). Otherwise reinstall numpy.

Original error was: DLL load failed: Das angegebene Modul wurde nicht gefunden.

If I try to use numpy directly, I get this:

>> x = py.numpy.random.random([4,4]);

Undefined variable "py" or class "py.numpy.random.random".

Calling

help(‘textwrap’)

or

help(‘numpy’)

in Python works fine. Calling

py.help(‘textwrap’)

in Matlab works,

py.help(‘numpy’)

does not.

I have tried to update numpy and to remove and reinstall it, but this does nothing. I am using Python 3.6 which should be supported.

>> pyversion

version: ‘3.6’

executable: ‘C:ProgramDataAnaconda3python.exe’

library: ‘C:ProgramDataAnaconda3python36.dll’

home: ‘C:ProgramDataAnaconda3’

isloaded: 1

Maybe I am doing something wrong?I have started to try to use python functionality in matlab. The <https://ch.mathworks.com/help/matlab/matlab_external/create-object-from-python-class.html Textwrapper> example works. I now tried other packages, and everytime there is some dependency on numpy I get this message:

>> py.help(‘numpy’)

problem in numpy – ImportError:

Importing the multiarray numpy extension module failed. Most

likely you are trying to import a failed build of numpy.

If you’re working with a numpy git repo, try `git clean -xdf` (removes all

files not under version control). Otherwise reinstall numpy.

Original error was: DLL load failed: Das angegebene Modul wurde nicht gefunden.

If I try to use numpy directly, I get this:

>> x = py.numpy.random.random([4,4]);

Undefined variable "py" or class "py.numpy.random.random".

Calling

help(‘textwrap’)

or

help(‘numpy’)

in Python works fine. Calling

py.help(‘textwrap’)

in Matlab works,

py.help(‘numpy’)

does not.

I have tried to update numpy and to remove and reinstall it, but this does nothing. I am using Python 3.6 which should be supported.

>> pyversion

version: ‘3.6’

executable: ‘C:ProgramDataAnaconda3python.exe’

library: ‘C:ProgramDataAnaconda3python36.dll’

home: ‘C:ProgramDataAnaconda3’

isloaded: 1

Maybe I am doing something wrong? I have started to try to use python functionality in matlab. The <https://ch.mathworks.com/help/matlab/matlab_external/create-object-from-python-class.html Textwrapper> example works. I now tried other packages, and everytime there is some dependency on numpy I get this message:

>> py.help(‘numpy’)

problem in numpy – ImportError:

Importing the multiarray numpy extension module failed. Most

likely you are trying to import a failed build of numpy.

If you’re working with a numpy git repo, try `git clean -xdf` (removes all

files not under version control). Otherwise reinstall numpy.

Original error was: DLL load failed: Das angegebene Modul wurde nicht gefunden.

If I try to use numpy directly, I get this:

>> x = py.numpy.random.random([4,4]);

Undefined variable "py" or class "py.numpy.random.random".

Calling

help(‘textwrap’)

or

help(‘numpy’)

in Python works fine. Calling

py.help(‘textwrap’)

in Matlab works,

py.help(‘numpy’)

does not.

I have tried to update numpy and to remove and reinstall it, but this does nothing. I am using Python 3.6 which should be supported.

>> pyversion

version: ‘3.6’

executable: ‘C:ProgramDataAnaconda3python.exe’

library: ‘C:ProgramDataAnaconda3python36.dll’

home: ‘C:ProgramDataAnaconda3’

isloaded: 1

Maybe I am doing something wrong? python, python call, numpy, python in matlab, numpy framework MATLAB Answers — New Questions

## How can i generate PPM,PAM,PWM modulation and demodulation .

I have tried the function pammod also but i couldnt get the output, please help me to generate PAM,PPM,PWM.I have tried the function pammod also but i couldnt get the output, please help me to generate PAM,PPM,PWM. I have tried the function pammod also but i couldnt get the output, please help me to generate PAM,PPM,PWM. pwm, power_electronics_control, electric_motor_control, power_conversion_control MATLAB Answers — New Questions

## Calculation of the moving mean for the first items

Hello.

I am trying to understand the calculations regarding to movmean command.

Let say I have the following array, and I want to calculate the movmean with a windowsize of 2

A = [4 8 6 -1 -2 -3 -1 3 4 5];

M = movmean(A,2)

Within the result, I do not understand how I got the first element 4.0000 (i.e., the first iteration)

Now, let say I use a windowsize of 3

A = [4 8 6 -1 -2 -3 -1 3 4 5];

M = movmean(A,3)

I do not understand how I got the first element 6.0000 (i.e., the first iteration)

Now, let say I use a windowsize of 4

A = [4 8 6 -1 -2 -3 -1 3 4 5];

M = movmean(A,4)

I do not understand how I got the first two elements 6.0000 and 6.0000 (i.e., the first two iteration)

So forth untill a windowsize of 10.

I appreciated you cooperation.Hello.

I am trying to understand the calculations regarding to movmean command.

Let say I have the following array, and I want to calculate the movmean with a windowsize of 2

A = [4 8 6 -1 -2 -3 -1 3 4 5];

M = movmean(A,2)

Within the result, I do not understand how I got the first element 4.0000 (i.e., the first iteration)

Now, let say I use a windowsize of 3

A = [4 8 6 -1 -2 -3 -1 3 4 5];

M = movmean(A,3)

I do not understand how I got the first element 6.0000 (i.e., the first iteration)

Now, let say I use a windowsize of 4

A = [4 8 6 -1 -2 -3 -1 3 4 5];

M = movmean(A,4)

I do not understand how I got the first two elements 6.0000 and 6.0000 (i.e., the first two iteration)

So forth untill a windowsize of 10.

I appreciated you cooperation. Hello.

I am trying to understand the calculations regarding to movmean command.

Let say I have the following array, and I want to calculate the movmean with a windowsize of 2

A = [4 8 6 -1 -2 -3 -1 3 4 5];

M = movmean(A,2)

Within the result, I do not understand how I got the first element 4.0000 (i.e., the first iteration)

Now, let say I use a windowsize of 3

A = [4 8 6 -1 -2 -3 -1 3 4 5];

M = movmean(A,3)

I do not understand how I got the first element 6.0000 (i.e., the first iteration)

Now, let say I use a windowsize of 4

A = [4 8 6 -1 -2 -3 -1 3 4 5];

M = movmean(A,4)

I do not understand how I got the first two elements 6.0000 and 6.0000 (i.e., the first two iteration)

So forth untill a windowsize of 10.

I appreciated you cooperation. matlab, movmean MATLAB Answers — New Questions

## The relationship y = a*x*eb*x, where a and b are unknown coefficients, is estimated to fit the following data set: x 0.1 0.2 0.4 0.6 0.9 1.3 1.5 1.7 1.8 y 0.75 1.25 1.45 1.

The relationship y = a*x*eb*x, where a and b are unknown coefficients, is estimated to fit the following data set: x 0.1 0.2 0.4 0.6 0.9 1.3 1.5 1.7 1.8 y 0.75 1.25 1.45 1.25 0.85 0.55 0.35 0.28 0.18

Write a program using non-linear regression to estimate the values of a and b. This is an iterative process. You need to define the criterion for convergence, which is the tolerance between the values of a and b in two successive iterations. If the differences of both a and b in two successive iterations are less than this tolerance (say 10-4), the process has converged.

Check the number of iterations it takes to converge. Submit in a report the resulting values of a and b, the number of iterations the process takes to converge, and a plot showing the data and the fitted curve, to check visually the quality of the fit.

Please submit your program also. You may use functions from the numpy library to perform the required matrix operations, such as numpy.linalg.inv for inverting a matrix, numpy.linalg.matrix_transpose for transposing a matrix, numpy.linalg.matmul for matrix-matrix multiplication, and so forth.The relationship y = a*x*eb*x, where a and b are unknown coefficients, is estimated to fit the following data set: x 0.1 0.2 0.4 0.6 0.9 1.3 1.5 1.7 1.8 y 0.75 1.25 1.45 1.25 0.85 0.55 0.35 0.28 0.18

Write a program using non-linear regression to estimate the values of a and b. This is an iterative process. You need to define the criterion for convergence, which is the tolerance between the values of a and b in two successive iterations. If the differences of both a and b in two successive iterations are less than this tolerance (say 10-4), the process has converged.

Check the number of iterations it takes to converge. Submit in a report the resulting values of a and b, the number of iterations the process takes to converge, and a plot showing the data and the fitted curve, to check visually the quality of the fit.

Please submit your program also. You may use functions from the numpy library to perform the required matrix operations, such as numpy.linalg.inv for inverting a matrix, numpy.linalg.matrix_transpose for transposing a matrix, numpy.linalg.matmul for matrix-matrix multiplication, and so forth. The relationship y = a*x*eb*x, where a and b are unknown coefficients, is estimated to fit the following data set: x 0.1 0.2 0.4 0.6 0.9 1.3 1.5 1.7 1.8 y 0.75 1.25 1.45 1.25 0.85 0.55 0.35 0.28 0.18

Write a program using non-linear regression to estimate the values of a and b. This is an iterative process. You need to define the criterion for convergence, which is the tolerance between the values of a and b in two successive iterations. If the differences of both a and b in two successive iterations are less than this tolerance (say 10-4), the process has converged.

Check the number of iterations it takes to converge. Submit in a report the resulting values of a and b, the number of iterations the process takes to converge, and a plot showing the data and the fitted curve, to check visually the quality of the fit.

Please submit your program also. You may use functions from the numpy library to perform the required matrix operations, such as numpy.linalg.inv for inverting a matrix, numpy.linalg.matrix_transpose for transposing a matrix, numpy.linalg.matmul for matrix-matrix multiplication, and so forth. the relationship y = a*x*eb*x, where a and b are u, for loop MATLAB Answers — New Questions

## Non-integer value in for-loop

Probably a simple question but why non-integer value can’t be used in for-loop.

for i=0:.1:1

H(i)=10*i ;

end

H

how do i use any non-integer value in for-loop?

Appriciate your help.Probably a simple question but why non-integer value can’t be used in for-loop.

for i=0:.1:1

H(i)=10*i ;

end

H

how do i use any non-integer value in for-loop?

Appriciate your help. Probably a simple question but why non-integer value can’t be used in for-loop.

for i=0:.1:1

H(i)=10*i ;

end

H

how do i use any non-integer value in for-loop?

Appriciate your help. for loop, non-integer for loop MATLAB Answers — New Questions

## Complete transformer model (Encoder + Decoder + Interconections)

Hello

I am wondering if there is already a Matlab keyboard warrior that has coded (on Matlab) a full transformer model:

Inputs: Input Embedding + Positional Encoding

Encoder: Multihead Attention + Add & Normalisation + Feedforward + Add & Normatisation

Outputs: Output Embedding + Positional Encoding

Decoder: Masked Multihead Attention + Add & Normalisation + Multihead Attention + Add & Normalisation + Feedforward + Add & Normatisation

Final: Linear and Softmax.

Including all the interconnections between them.

Thank you

WillHello

I am wondering if there is already a Matlab keyboard warrior that has coded (on Matlab) a full transformer model:

Inputs: Input Embedding + Positional Encoding

Encoder: Multihead Attention + Add & Normalisation + Feedforward + Add & Normatisation

Outputs: Output Embedding + Positional Encoding

Decoder: Masked Multihead Attention + Add & Normalisation + Multihead Attention + Add & Normalisation + Feedforward + Add & Normatisation

Final: Linear and Softmax.

Including all the interconnections between them.

Thank you

Will Hello

I am wondering if there is already a Matlab keyboard warrior that has coded (on Matlab) a full transformer model:

Inputs: Input Embedding + Positional Encoding

Encoder: Multihead Attention + Add & Normalisation + Feedforward + Add & Normatisation

Outputs: Output Embedding + Positional Encoding

Decoder: Masked Multihead Attention + Add & Normalisation + Multihead Attention + Add & Normalisation + Feedforward + Add & Normatisation

Final: Linear and Softmax.

Including all the interconnections between them.

Thank you

Will transformer, encoder, decoder, attention MATLAB Answers — New Questions

## Name is nonexistent or not a directory

When I open the Matlab2021b,the following issues have occurred,but none of these paths appeared in my set path and pathdef.m.There’s nothing in the startup.m eitherWhen I open the Matlab2021b,the following issues have occurred,but none of these paths appeared in my set path and pathdef.m.There’s nothing in the startup.m either When I open the Matlab2021b,the following issues have occurred,but none of these paths appeared in my set path and pathdef.m.There’s nothing in the startup.m either path, pathdefpath MATLAB Answers — New Questions

## code fro Methods of Moments

hI

I m looking for code related with Methods of Moments in Elecromgnegmetic

ThankhI

I m looking for code related with Methods of Moments in Elecromgnegmetic

Thank hI

I m looking for code related with Methods of Moments in Elecromgnegmetic

Thank electromagmetic, methods of moments MATLAB Answers — New Questions

## The parallel cluster becomes unresponsive, while the program runs normally on local pool workers. How can this issue be resolved?

I have developed a program that utilizes parfor to run parallel workers. The structure of the program is as follows:

parfor ix = 1:numel(param_files)

% Read the parameter files

% Run fmincon optimization

end

The program functioned normally with all param_files when executed using local workers. However, when I attempted to run it on a parallel cluster, it became unresponsive for many hours while processing one of the parameter files during the optimization phase. As a result, I had to manually stop the parallel cluster. (Note: The hardware capabilities of the parallel cluster server are equivalent to those of my local PC.)I have developed a program that utilizes parfor to run parallel workers. The structure of the program is as follows:

parfor ix = 1:numel(param_files)

% Read the parameter files

% Run fmincon optimization

end

The program functioned normally with all param_files when executed using local workers. However, when I attempted to run it on a parallel cluster, it became unresponsive for many hours while processing one of the parameter files during the optimization phase. As a result, I had to manually stop the parallel cluster. (Note: The hardware capabilities of the parallel cluster server are equivalent to those of my local PC.) I have developed a program that utilizes parfor to run parallel workers. The structure of the program is as follows:

parfor ix = 1:numel(param_files)

% Read the parameter files

% Run fmincon optimization

end

The program functioned normally with all param_files when executed using local workers. However, when I attempted to run it on a parallel cluster, it became unresponsive for many hours while processing one of the parameter files during the optimization phase. As a result, I had to manually stop the parallel cluster. (Note: The hardware capabilities of the parallel cluster server are equivalent to those of my local PC.) paralell-cluster, parallel computing toolbox, parfor MATLAB Answers — New Questions

## Dimensionless variables of the differential equation

Hello all,

I hope you are all doing well. I have established a 2DOF differetial equation. Basically, the equations are the 2 spring-mass-damper system. But I am wondering how to define the variable X to be a dimentionless variable, such as X/L. In my equations, the variable X should be dimensionless but when I exclude the force (F_o the dimensionless force), the results of the equation are not dimensionless which I have already checked. My codes are attached. I think you can easily run it.

I appreciate your support.

Best wishes,

Yu

clc;

clear all;

tspan = 0:0.25:200;

X0 = [0 0 0 0];

%parameters——-

mu = 0.02; % mass ratio

f_opt = 1/(1+mu); %frequency ratio

xi_2 = sqrt(3*mu/8*(1+mu));

Omega_1 = 0.188; % 0.03 Hz

Omega_2 = Omega_1*f_opt; % frequency of the second DOF

xi_1 = 0.01;

%matrix——–

M = [1+mu mu;

1 1];

C = [2*xi_1*Omega_1 0;

0 2*xi_2*Omega_2];

K = [Omega_1^2 0;

0 Omega_2^2];

% state space model——————-

O = zeros(2,2);

I = eye(2);

A = [O I; -inv(M)*K -inv(M)*C];

B = [O; inv(M)];

E = [I O];

D = zeros(2,2);

% solve the equations——————-

options = odeset(‘RelTol’,1e-10,’AbsTol’,1e-10);

[t,X] = ode45(@(t,X) QZSdamper(t,A,B,X),tspan,X0,options);

x = X(:,1:4);

% F_o = 2*Omega_2.^2.*alpha.*(sqrt(1-gamma.^2)+X(:,2)).*(-1+sqrt(1/(X(:,2).^2+2.*sqrt(1-gamma^2).*X(:,2)+1)));

%

% f_s = Omega_2.^2*(X(:,2)-2*alpha*(sqrt(1-gamma^2)+X(:,2))*(-1+sqrt(1/(X(:,2).^2+2*sqrt(1-gamma^2)*X(:,2)+1))));

%

% f_1 = f_s(:,1);

%

% figure,

% plot(t,f_1);

figure,

plot(t,x(:,1)); xlabel(‘Time/s’),ylabel(‘Dimensionless displacement of primary structure’)

figure,

plot(t,(x(:,2)))

sys = ss(A,B,E,D);

figure,

bodeplot(sys(1,1)) % from input 1 to output 3

bp.FrequencyScale = "linear";

[mag,phase,wout] = bode(sys(1,1));

mag = squeeze(mag);

phase = squeeze(phase);

fout = wout/(2*pi);

BodeTable = table(fout,mag,phase);

function dXdt = QZSdamper(t,A,B,X)

mu = 0.025;

alpha = 1;

gamma = 2*alpha/(2*alpha+1);

f_opt = 1/(1+mu);

Omega_1 = 0.188; % 0.03 Hz

Omega_2 = Omega_1*f_opt;

w = 0.180;

F = 0.001*sin(w*t);

F_o = 2*Omega_2^2*alpha*(sqrt(1-gamma^2)+X(2))*(sqrt(1/(X(2)^2+2*sqrt(1-gamma^2)*X(2)+1))-1);

% F_o = Omega_2^2*(sqrt(1-gamma^2)+2*alpha*(X(2))*(1/((X(2)-sqrt(1-gamma^2))^2+2*sqrt(1-gamma^2)*(X(2)-sqrt(1-gamma^2))+1)^(1/2)-1))

F = [F;F_o];

dXdt = A*X+B*(F);

endHello all,

I hope you are all doing well. I have established a 2DOF differetial equation. Basically, the equations are the 2 spring-mass-damper system. But I am wondering how to define the variable X to be a dimentionless variable, such as X/L. In my equations, the variable X should be dimensionless but when I exclude the force (F_o the dimensionless force), the results of the equation are not dimensionless which I have already checked. My codes are attached. I think you can easily run it.

I appreciate your support.

Best wishes,

Yu

clc;

clear all;

tspan = 0:0.25:200;

X0 = [0 0 0 0];

%parameters——-

mu = 0.02; % mass ratio

f_opt = 1/(1+mu); %frequency ratio

xi_2 = sqrt(3*mu/8*(1+mu));

Omega_1 = 0.188; % 0.03 Hz

Omega_2 = Omega_1*f_opt; % frequency of the second DOF

xi_1 = 0.01;

%matrix——–

M = [1+mu mu;

1 1];

C = [2*xi_1*Omega_1 0;

0 2*xi_2*Omega_2];

K = [Omega_1^2 0;

0 Omega_2^2];

% state space model——————-

O = zeros(2,2);

I = eye(2);

A = [O I; -inv(M)*K -inv(M)*C];

B = [O; inv(M)];

E = [I O];

D = zeros(2,2);

% solve the equations——————-

options = odeset(‘RelTol’,1e-10,’AbsTol’,1e-10);

[t,X] = ode45(@(t,X) QZSdamper(t,A,B,X),tspan,X0,options);

x = X(:,1:4);

% F_o = 2*Omega_2.^2.*alpha.*(sqrt(1-gamma.^2)+X(:,2)).*(-1+sqrt(1/(X(:,2).^2+2.*sqrt(1-gamma^2).*X(:,2)+1)));

%

% f_s = Omega_2.^2*(X(:,2)-2*alpha*(sqrt(1-gamma^2)+X(:,2))*(-1+sqrt(1/(X(:,2).^2+2*sqrt(1-gamma^2)*X(:,2)+1))));

%

% f_1 = f_s(:,1);

%

% figure,

% plot(t,f_1);

figure,

plot(t,x(:,1)); xlabel(‘Time/s’),ylabel(‘Dimensionless displacement of primary structure’)

figure,

plot(t,(x(:,2)))

sys = ss(A,B,E,D);

figure,

bodeplot(sys(1,1)) % from input 1 to output 3

bp.FrequencyScale = "linear";

[mag,phase,wout] = bode(sys(1,1));

mag = squeeze(mag);

phase = squeeze(phase);

fout = wout/(2*pi);

BodeTable = table(fout,mag,phase);

function dXdt = QZSdamper(t,A,B,X)

mu = 0.025;

alpha = 1;

gamma = 2*alpha/(2*alpha+1);

f_opt = 1/(1+mu);

Omega_1 = 0.188; % 0.03 Hz

Omega_2 = Omega_1*f_opt;

w = 0.180;

F = 0.001*sin(w*t);

F_o = 2*Omega_2^2*alpha*(sqrt(1-gamma^2)+X(2))*(sqrt(1/(X(2)^2+2*sqrt(1-gamma^2)*X(2)+1))-1);

% F_o = Omega_2^2*(sqrt(1-gamma^2)+2*alpha*(X(2))*(1/((X(2)-sqrt(1-gamma^2))^2+2*sqrt(1-gamma^2)*(X(2)-sqrt(1-gamma^2))+1)^(1/2)-1))

F = [F;F_o];

dXdt = A*X+B*(F);

end Hello all,

I hope you are all doing well. I have established a 2DOF differetial equation. Basically, the equations are the 2 spring-mass-damper system. But I am wondering how to define the variable X to be a dimentionless variable, such as X/L. In my equations, the variable X should be dimensionless but when I exclude the force (F_o the dimensionless force), the results of the equation are not dimensionless which I have already checked. My codes are attached. I think you can easily run it.

I appreciate your support.

Best wishes,

Yu

clc;

clear all;

tspan = 0:0.25:200;

X0 = [0 0 0 0];

%parameters——-

mu = 0.02; % mass ratio

f_opt = 1/(1+mu); %frequency ratio

xi_2 = sqrt(3*mu/8*(1+mu));

Omega_1 = 0.188; % 0.03 Hz

Omega_2 = Omega_1*f_opt; % frequency of the second DOF

xi_1 = 0.01;

%matrix——–

M = [1+mu mu;

1 1];

C = [2*xi_1*Omega_1 0;

0 2*xi_2*Omega_2];

K = [Omega_1^2 0;

0 Omega_2^2];

% state space model——————-

O = zeros(2,2);

I = eye(2);

A = [O I; -inv(M)*K -inv(M)*C];

B = [O; inv(M)];

E = [I O];

D = zeros(2,2);

% solve the equations——————-

options = odeset(‘RelTol’,1e-10,’AbsTol’,1e-10);

[t,X] = ode45(@(t,X) QZSdamper(t,A,B,X),tspan,X0,options);

x = X(:,1:4);

% F_o = 2*Omega_2.^2.*alpha.*(sqrt(1-gamma.^2)+X(:,2)).*(-1+sqrt(1/(X(:,2).^2+2.*sqrt(1-gamma^2).*X(:,2)+1)));

%

% f_s = Omega_2.^2*(X(:,2)-2*alpha*(sqrt(1-gamma^2)+X(:,2))*(-1+sqrt(1/(X(:,2).^2+2*sqrt(1-gamma^2)*X(:,2)+1))));

%

% f_1 = f_s(:,1);

%

% figure,

% plot(t,f_1);

figure,

plot(t,x(:,1)); xlabel(‘Time/s’),ylabel(‘Dimensionless displacement of primary structure’)

figure,

plot(t,(x(:,2)))

sys = ss(A,B,E,D);

figure,

bodeplot(sys(1,1)) % from input 1 to output 3

bp.FrequencyScale = "linear";

[mag,phase,wout] = bode(sys(1,1));

mag = squeeze(mag);

phase = squeeze(phase);

fout = wout/(2*pi);

BodeTable = table(fout,mag,phase);

function dXdt = QZSdamper(t,A,B,X)

mu = 0.025;

alpha = 1;

gamma = 2*alpha/(2*alpha+1);

f_opt = 1/(1+mu);

Omega_1 = 0.188; % 0.03 Hz

Omega_2 = Omega_1*f_opt;

w = 0.180;

F = 0.001*sin(w*t);

F_o = 2*Omega_2^2*alpha*(sqrt(1-gamma^2)+X(2))*(sqrt(1/(X(2)^2+2*sqrt(1-gamma^2)*X(2)+1))-1);

% F_o = Omega_2^2*(sqrt(1-gamma^2)+2*alpha*(X(2))*(1/((X(2)-sqrt(1-gamma^2))^2+2*sqrt(1-gamma^2)*(X(2)-sqrt(1-gamma^2))+1)^(1/2)-1))

F = [F;F_o];

dXdt = A*X+B*(F);

end ode45, dimensionless expressions, differential equations MATLAB Answers — New Questions

## Cannot open file “.” for reading. You might not have read permission.

I am trying to loop through a file and read each image in turn. However, it keeps saying I dont have read permission.

How do I fix this? Thank you!

dataset = dir(‘/Users/Desktop/Image Dataset’);

numFiles = length(dataset);

mydata = cell(1,numFiles);

for k = 1:numFiles

mydata{k} = imread(dataset(k).name);

axes(handles.axes1)

imshow(mydata{k})

endI am trying to loop through a file and read each image in turn. However, it keeps saying I dont have read permission.

How do I fix this? Thank you!

dataset = dir(‘/Users/Desktop/Image Dataset’);

numFiles = length(dataset);

mydata = cell(1,numFiles);

for k = 1:numFiles

mydata{k} = imread(dataset(k).name);

axes(handles.axes1)

imshow(mydata{k})

end I am trying to loop through a file and read each image in turn. However, it keeps saying I dont have read permission.

How do I fix this? Thank you!

dataset = dir(‘/Users/Desktop/Image Dataset’);

numFiles = length(dataset);

mydata = cell(1,numFiles);

for k = 1:numFiles

mydata{k} = imread(dataset(k).name);

axes(handles.axes1)

imshow(mydata{k})

end imread MATLAB Answers — New Questions

## How to generate edge-information from a pde mesh?

Hi there,

My task is generating a list of all edges in mesh. (ps. I mean not edges of geometry, i saw some function there, which shows edges of a geometry, they are performed bases on interacting between mesh and geometry.)

For a mesh i can easily get access to elements (3d : tetraeder). I am considering break down each element into four faces. It’s easy for me to get edges from faces (2nd step).

(elements -> faces -> edges)

now the problem is in 1st step. A 3d quadratic case, that means an element consists of ten nodes. I have no idea which node is vertices which is in middle of edges.

The way to create mesh :

cubic = [100, 50, 20];

model = createpde(thermal="transient");

geo = multicuboid(cubic(1), cubic(2),…

cubic(3), ‘Zoffset’, 0);

model.Geometry = geo;

generateMesh(model, GeometricOrder=’quadratic’);

pdemesh(model)

Is there any tips for me?

Thank you all.

Best regards

KunHi there,

My task is generating a list of all edges in mesh. (ps. I mean not edges of geometry, i saw some function there, which shows edges of a geometry, they are performed bases on interacting between mesh and geometry.)

For a mesh i can easily get access to elements (3d : tetraeder). I am considering break down each element into four faces. It’s easy for me to get edges from faces (2nd step).

(elements -> faces -> edges)

now the problem is in 1st step. A 3d quadratic case, that means an element consists of ten nodes. I have no idea which node is vertices which is in middle of edges.

The way to create mesh :

cubic = [100, 50, 20];

model = createpde(thermal="transient");

geo = multicuboid(cubic(1), cubic(2),…

cubic(3), ‘Zoffset’, 0);

model.Geometry = geo;

generateMesh(model, GeometricOrder=’quadratic’);

pdemesh(model)

Is there any tips for me?

Thank you all.

Best regards

Kun Hi there,

My task is generating a list of all edges in mesh. (ps. I mean not edges of geometry, i saw some function there, which shows edges of a geometry, they are performed bases on interacting between mesh and geometry.)

For a mesh i can easily get access to elements (3d : tetraeder). I am considering break down each element into four faces. It’s easy for me to get edges from faces (2nd step).

(elements -> faces -> edges)

now the problem is in 1st step. A 3d quadratic case, that means an element consists of ten nodes. I have no idea which node is vertices which is in middle of edges.

The way to create mesh :

cubic = [100, 50, 20];

model = createpde(thermal="transient");

geo = multicuboid(cubic(1), cubic(2),…

cubic(3), ‘Zoffset’, 0);

model.Geometry = geo;

generateMesh(model, GeometricOrder=’quadratic’);

pdemesh(model)

Is there any tips for me?

Thank you all.

Best regards

Kun pde_mesh, edge_of_mesh MATLAB Answers — New Questions

## How many template of 3D graph exist in Matlab ?

As we know there is a lot template for sketch the 3D graph in matlab like real imaginary absolute and contour and density and so on how we can gether them in one package any one have it?As we know there is a lot template for sketch the 3D graph in matlab like real imaginary absolute and contour and density and so on how we can gether them in one package any one have it? As we know there is a lot template for sketch the 3D graph in matlab like real imaginary absolute and contour and density and so on how we can gether them in one package any one have it? 3d plots, graph, 2d plots, combine plots, plot MATLAB Answers — New Questions

## Linearized model / alternative of a MOSFET for real-time simulations

Hello everyone,

I’m having problems with the heavy computational load of a Simulink model while running it in real-time. The profiler indicates that the model’s switches are consuming a significant amount of computation time. Does anyone have any recommendations for me, or have they encountered similar issues? If so, please assist me in resolving the issue.

I was wondering if somebody has any alternative model for a MOSFET (or a switch acts as a circuit breaker) that makes the simulations a bit less non-linear. That would be highly appreciated.

Thank youHello everyone,

I’m having problems with the heavy computational load of a Simulink model while running it in real-time. The profiler indicates that the model’s switches are consuming a significant amount of computation time. Does anyone have any recommendations for me, or have they encountered similar issues? If so, please assist me in resolving the issue.

I was wondering if somebody has any alternative model for a MOSFET (or a switch acts as a circuit breaker) that makes the simulations a bit less non-linear. That would be highly appreciated.

Thank you Hello everyone,

I’m having problems with the heavy computational load of a Simulink model while running it in real-time. The profiler indicates that the model’s switches are consuming a significant amount of computation time. Does anyone have any recommendations for me, or have they encountered similar issues? If so, please assist me in resolving the issue.

I was wondering if somebody has any alternative model for a MOSFET (or a switch acts as a circuit breaker) that makes the simulations a bit less non-linear. That would be highly appreciated.

Thank you real-time simulation, switch, mosfet, speedgoat MATLAB Answers — New Questions

## How to pass parameter to a MATLAB program from Python ??

I would like to write a python program who pass parameters to a MATLAB program and run it, but don’t know how to do ??

Python program :

import matlab.engine;

eng = matlab.engine.start_matlab()

x = 0;

y = 1;

z = 2;

print(x);

print(y);

print(z);

eng.Python_testing(nargout=0)

==> HOW TO PASS x,y,z, to Python_testing.m ??

MATLAB Program Python_testing.m

x,y,z

<== HOW TO RECEIVE the parameter x,y,z in MATLAB from PYTHON program

a = 0.5*(x + y + z)

return a

<== Can a be returned back to Python program ? If so, how to do it ??I would like to write a python program who pass parameters to a MATLAB program and run it, but don’t know how to do ??

Python program :

import matlab.engine;

eng = matlab.engine.start_matlab()

x = 0;

y = 1;

z = 2;

print(x);

print(y);

print(z);

eng.Python_testing(nargout=0)

==> HOW TO PASS x,y,z, to Python_testing.m ??

MATLAB Program Python_testing.m

x,y,z

<== HOW TO RECEIVE the parameter x,y,z in MATLAB from PYTHON program

a = 0.5*(x + y + z)

return a

<== Can a be returned back to Python program ? If so, how to do it ?? I would like to write a python program who pass parameters to a MATLAB program and run it, but don’t know how to do ??

Python program :

import matlab.engine;

eng = matlab.engine.start_matlab()

x = 0;

y = 1;

z = 2;

print(x);

print(y);

print(z);

eng.Python_testing(nargout=0)

==> HOW TO PASS x,y,z, to Python_testing.m ??

MATLAB Program Python_testing.m

x,y,z

<== HOW TO RECEIVE the parameter x,y,z in MATLAB from PYTHON program

a = 0.5*(x + y + z)

return a

<== Can a be returned back to Python program ? If so, how to do it ?? python MATLAB Answers — New Questions

## How i can combine two or three 3D plot ? how get the template of such graph?

how i can have template of such graph in below mention it and there is any other template of graph surface? and how i can combine two or more 3D graph in one graph and with one template ? if have a template please share it and plot this kind of graph

(((cosh(0.5e0 * x + 0.20e1 * t) + 0.1e1) / cosh(0.5e0 * x + 0.20e1 * t)) ^ (0.1e1 / 0.6e1)) * exp(i * (-0.2e1 * x – 0.4034722222e1 * t))how i can have template of such graph in below mention it and there is any other template of graph surface? and how i can combine two or more 3D graph in one graph and with one template ? if have a template please share it and plot this kind of graph

(((cosh(0.5e0 * x + 0.20e1 * t) + 0.1e1) / cosh(0.5e0 * x + 0.20e1 * t)) ^ (0.1e1 / 0.6e1)) * exp(i * (-0.2e1 * x – 0.4034722222e1 * t)) how i can have template of such graph in below mention it and there is any other template of graph surface? and how i can combine two or more 3D graph in one graph and with one template ? if have a template please share it and plot this kind of graph

(((cosh(0.5e0 * x + 0.20e1 * t) + 0.1e1) / cosh(0.5e0 * x + 0.20e1 * t)) ^ (0.1e1 / 0.6e1)) * exp(i * (-0.2e1 * x – 0.4034722222e1 * t)) 3d plots, graph MATLAB Answers — New Questions

## How i can combine two or three 3D plot ? how get the template of such graph?

how i can have template of such graph in below mention it and there is any other template of graph surface? and how i can combine two or more 3D graph in one graph and with one template ? if have a template please share it and plot this kind of graph

(((cosh(0.5e0 * x + 0.20e1 * t) + 0.1e1) / cosh(0.5e0 * x + 0.20e1 * t)) ^ (0.1e1 / 0.6e1)) * exp(i * (-0.2e1 * x – 0.4034722222e1 * t))how i can have template of such graph in below mention it and there is any other template of graph surface? and how i can combine two or more 3D graph in one graph and with one template ? if have a template please share it and plot this kind of graph

(((cosh(0.5e0 * x + 0.20e1 * t) + 0.1e1) / cosh(0.5e0 * x + 0.20e1 * t)) ^ (0.1e1 / 0.6e1)) * exp(i * (-0.2e1 * x – 0.4034722222e1 * t)) how i can have template of such graph in below mention it and there is any other template of graph surface? and how i can combine two or more 3D graph in one graph and with one template ? if have a template please share it and plot this kind of graph

(((cosh(0.5e0 * x + 0.20e1 * t) + 0.1e1) / cosh(0.5e0 * x + 0.20e1 * t)) ^ (0.1e1 / 0.6e1)) * exp(i * (-0.2e1 * x – 0.4034722222e1 * t)) 3d plots, graph MATLAB Answers — New Questions

## Controlling a prosthetic hand

I took an EMG signal of 17 hand gestures from 43 person separately and now I have the dataset of these signals. After doing segmentation, DFTI, Feature-Extraction and classification how can I identify the the movement to the servo ?I took an EMG signal of 17 hand gestures from 43 person separately and now I have the dataset of these signals. After doing segmentation, DFTI, Feature-Extraction and classification how can I identify the the movement to the servo ? I took an EMG signal of 17 hand gestures from 43 person separately and now I have the dataset of these signals. After doing segmentation, DFTI, Feature-Extraction and classification how can I identify the the movement to the servo ? machine learning, deep learning MATLAB Answers — New Questions

## how i can find this in MATLAB in order to find (τ,ν): I want the code and i will fix it

(τ,ν)= argmax(τ,ν) xp^H A(τ,ν) (A(τ,ν)^H A(τ,ν))−1 A(τ,ν)H xp

how i can find this in matlab

note: all coefficients are vector

(τ,ν)= argmax(τ,ν) xp^H A(τ,ν) (A(τ,ν)^H A(τ,ν))−1 A(τ,ν)H xp

how i can find this in matlab

note: all coefficients are vector

(τ,ν)= argmax(τ,ν) xp^H A(τ,ν) (A(τ,ν)^H A(τ,ν))−1 A(τ,ν)H xp

how i can find this in matlab

note: all coefficients are vector

optimization MATLAB Answers — New Questions