Category: Matlab
Category Archives: Matlab
i have a matlab file with extension .MLAPP. i am not able to open it. does anyone knows the possible problems?
how to open mlapp file.
file is attached belowhow to open mlapp file.
file is attached below how to open mlapp file.
file is attached below mlapp, graphics, appbuilder MATLAB Answers — New Questions
Prepare a MATLAB code that develop Response Spectrum (Acceleration & Time ordinates) based on acceleration (m/s/s) & time(seconds) records contained in a .txt file?
Prepare a MATLAB code that develop Response Spectrum (Acceleration & Time ordinates) based on acceleration (m/s/s) & time(seconds) records contained in a .txt file for multiple damping ratio (i.e. 0%, 2%, 5% etc.)?
Please find the attached acceleration-time record (.txt file).Prepare a MATLAB code that develop Response Spectrum (Acceleration & Time ordinates) based on acceleration (m/s/s) & time(seconds) records contained in a .txt file for multiple damping ratio (i.e. 0%, 2%, 5% etc.)?
Please find the attached acceleration-time record (.txt file). Prepare a MATLAB code that develop Response Spectrum (Acceleration & Time ordinates) based on acceleration (m/s/s) & time(seconds) records contained in a .txt file for multiple damping ratio (i.e. 0%, 2%, 5% etc.)?
Please find the attached acceleration-time record (.txt file). response spectrum, ground motion records MATLAB Answers — New Questions
How do I fix my Nan issue within a recursive function?
For my recursive function, I am trying to create a hexadoku solver. One of my variables ‘mm’ keeps outputting a NaN even when I try to change the NaNs into -1. I also believe that there is a base I am missing in order for this function to end. I do realize that the readmatrix function will output a NaN where there isn’t an integer, but that is why there is the M(isnan(M)) = -1.
M = readmatrix("puzzle_1.in","FileType","text");
M(isnan(M)) = -1;
S = zeros(size(M));
Hexadoku(M,S)
function [S] = Hexadoku(M,S)
if ~exist(‘S’)
S = zeros(size(M));
end
FirstID = M==-1;
if isempty(FirstID)
M = S(:,:,size(S,4)+2);
else
[i,j] = ind2sub([16,16],FirstID);
for k = 1:16
ii = (ceil(i/4)-1)*4+5;
jj = (ceil(j/4)-1)*4+1;
mm = M(ii:ii+3,jj:jj+3);
mm(isnan(mm)) = -1;
if (M(i+1,:)==k)==0
if (M(:,j)==k)==0
if (mm(:)==k)==0
M(i+1,j) = k;
S = Hexadoku(M,S);
end
end
end
end
end
endFor my recursive function, I am trying to create a hexadoku solver. One of my variables ‘mm’ keeps outputting a NaN even when I try to change the NaNs into -1. I also believe that there is a base I am missing in order for this function to end. I do realize that the readmatrix function will output a NaN where there isn’t an integer, but that is why there is the M(isnan(M)) = -1.
M = readmatrix("puzzle_1.in","FileType","text");
M(isnan(M)) = -1;
S = zeros(size(M));
Hexadoku(M,S)
function [S] = Hexadoku(M,S)
if ~exist(‘S’)
S = zeros(size(M));
end
FirstID = M==-1;
if isempty(FirstID)
M = S(:,:,size(S,4)+2);
else
[i,j] = ind2sub([16,16],FirstID);
for k = 1:16
ii = (ceil(i/4)-1)*4+5;
jj = (ceil(j/4)-1)*4+1;
mm = M(ii:ii+3,jj:jj+3);
mm(isnan(mm)) = -1;
if (M(i+1,:)==k)==0
if (M(:,j)==k)==0
if (mm(:)==k)==0
M(i+1,j) = k;
S = Hexadoku(M,S);
end
end
end
end
end
end For my recursive function, I am trying to create a hexadoku solver. One of my variables ‘mm’ keeps outputting a NaN even when I try to change the NaNs into -1. I also believe that there is a base I am missing in order for this function to end. I do realize that the readmatrix function will output a NaN where there isn’t an integer, but that is why there is the M(isnan(M)) = -1.
M = readmatrix("puzzle_1.in","FileType","text");
M(isnan(M)) = -1;
S = zeros(size(M));
Hexadoku(M,S)
function [S] = Hexadoku(M,S)
if ~exist(‘S’)
S = zeros(size(M));
end
FirstID = M==-1;
if isempty(FirstID)
M = S(:,:,size(S,4)+2);
else
[i,j] = ind2sub([16,16],FirstID);
for k = 1:16
ii = (ceil(i/4)-1)*4+5;
jj = (ceil(j/4)-1)*4+1;
mm = M(ii:ii+3,jj:jj+3);
mm(isnan(mm)) = -1;
if (M(i+1,:)==k)==0
if (M(:,j)==k)==0
if (mm(:)==k)==0
M(i+1,j) = k;
S = Hexadoku(M,S);
end
end
end
end
end
end matrix, matrix manipulation, for loop, loops MATLAB Answers — New Questions
Subs does not work in my code.
Hi, my function should replace all the monomials that have negative degree from -M to -(4*M+8) with 1, since 0 will give an error, nevertheless, it doesn’t work the substitution function. Every time I try it, it doesn’t work. Could you please give me some ideas on how to solve this issue.
function [sMnew] = Cubic(k,M)
n= 3*k+1;
x= sym(‘x’);
c = sym( ‘c’, [1 M+3]);
% Define the sum of monomials with negative coefficients
CC = x;
for i = 2:M+3
CC = CC + c(1,i)*x^(-i+1);
end
sM = expand(CC^(n));
for i = M:1:4*M+8
sMnew = subs(sM, x^(-i), 1);
endHi, my function should replace all the monomials that have negative degree from -M to -(4*M+8) with 1, since 0 will give an error, nevertheless, it doesn’t work the substitution function. Every time I try it, it doesn’t work. Could you please give me some ideas on how to solve this issue.
function [sMnew] = Cubic(k,M)
n= 3*k+1;
x= sym(‘x’);
c = sym( ‘c’, [1 M+3]);
% Define the sum of monomials with negative coefficients
CC = x;
for i = 2:M+3
CC = CC + c(1,i)*x^(-i+1);
end
sM = expand(CC^(n));
for i = M:1:4*M+8
sMnew = subs(sM, x^(-i), 1);
end Hi, my function should replace all the monomials that have negative degree from -M to -(4*M+8) with 1, since 0 will give an error, nevertheless, it doesn’t work the substitution function. Every time I try it, it doesn’t work. Could you please give me some ideas on how to solve this issue.
function [sMnew] = Cubic(k,M)
n= 3*k+1;
x= sym(‘x’);
c = sym( ‘c’, [1 M+3]);
% Define the sum of monomials with negative coefficients
CC = x;
for i = 2:M+3
CC = CC + c(1,i)*x^(-i+1);
end
sM = expand(CC^(n));
for i = M:1:4*M+8
sMnew = subs(sM, x^(-i), 1);
end subs function, symbolic, matlab MATLAB Answers — New Questions
Error Using CAT12 Basic Models
Hello! I am trying to run the Basic Models function on CAT12 but every time I run the batch editor after specifying my model, I get the following error:
————————————————————————
15-Apr-2024 11:32:13 – Running job #1
————————————————————————
15-Apr-2024 11:32:13 – Running ‘Basic models’
Mapping files : …done
Design configuration : …done
Saving SPM configuration : …SPM.mat saved
Design reporting : 15-Apr-2024 11:32:22 – Failed ‘Basic models’
Error using matlab.graphics.axis.Axes/set
Invalid or deleted object.
In file "/Users/arjunthanaraju/Downloads/PhD/spm12/spm_DesRep.m" (v6070), function "spm_DesRep" at line 734.
In file "/Users/arjunthanaraju/Downloads/PhD/spm12/config/spm_run_factorial_design.m" (v7739), function "spm_run_factorial_design" at line 1073.
In file "/Users/arjunthanaraju/Downloads/PhD/spm12/toolbox/cat12/cat_conf_factorial.m" (???), function "cat_run_factorial_design" at line 1440.
The following modules did not run:
Failed: Basic models
Could someone help me overcome this error, please? Thanks!Hello! I am trying to run the Basic Models function on CAT12 but every time I run the batch editor after specifying my model, I get the following error:
————————————————————————
15-Apr-2024 11:32:13 – Running job #1
————————————————————————
15-Apr-2024 11:32:13 – Running ‘Basic models’
Mapping files : …done
Design configuration : …done
Saving SPM configuration : …SPM.mat saved
Design reporting : 15-Apr-2024 11:32:22 – Failed ‘Basic models’
Error using matlab.graphics.axis.Axes/set
Invalid or deleted object.
In file "/Users/arjunthanaraju/Downloads/PhD/spm12/spm_DesRep.m" (v6070), function "spm_DesRep" at line 734.
In file "/Users/arjunthanaraju/Downloads/PhD/spm12/config/spm_run_factorial_design.m" (v7739), function "spm_run_factorial_design" at line 1073.
In file "/Users/arjunthanaraju/Downloads/PhD/spm12/toolbox/cat12/cat_conf_factorial.m" (???), function "cat_run_factorial_design" at line 1440.
The following modules did not run:
Failed: Basic models
Could someone help me overcome this error, please? Thanks! Hello! I am trying to run the Basic Models function on CAT12 but every time I run the batch editor after specifying my model, I get the following error:
————————————————————————
15-Apr-2024 11:32:13 – Running job #1
————————————————————————
15-Apr-2024 11:32:13 – Running ‘Basic models’
Mapping files : …done
Design configuration : …done
Saving SPM configuration : …SPM.mat saved
Design reporting : 15-Apr-2024 11:32:22 – Failed ‘Basic models’
Error using matlab.graphics.axis.Axes/set
Invalid or deleted object.
In file "/Users/arjunthanaraju/Downloads/PhD/spm12/spm_DesRep.m" (v6070), function "spm_DesRep" at line 734.
In file "/Users/arjunthanaraju/Downloads/PhD/spm12/config/spm_run_factorial_design.m" (v7739), function "spm_run_factorial_design" at line 1073.
In file "/Users/arjunthanaraju/Downloads/PhD/spm12/toolbox/cat12/cat_conf_factorial.m" (???), function "cat_run_factorial_design" at line 1440.
The following modules did not run:
Failed: Basic models
Could someone help me overcome this error, please? Thanks! spm, cat12 MATLAB Answers — New Questions
How to get the formal expression of the expansion of power of a polynomial with symbolic calculation
My question is described as below.
I am not familiar with the Matlab tool, so how to get the formal expression of the coefficient of eahc x^i term with symbolic calculation?My question is described as below.
I am not familiar with the Matlab tool, so how to get the formal expression of the coefficient of eahc x^i term with symbolic calculation? My question is described as below.
I am not familiar with the Matlab tool, so how to get the formal expression of the coefficient of eahc x^i term with symbolic calculation? polynomial coefficient, symbolic, matlab MATLAB Answers — New Questions
Why won’t my cycles overlap properly?
%this code works but not the way i want it, the cycles are supposted to overlap more symmetrically but three of them are longer than the rest
subplot(2,2,3);
hold on;
max_length = max(cellfun(@length, cycle_flows));
for i = 1:length(cycle_flows)
x = 1:max_length;
y = NaN(1, max_length); % Initialize with NaNs
y(1:length(cycle_flows{i})) = cycle_flows{i};
plot(x, y);
end
hold off;%this code works but not the way i want it, the cycles are supposted to overlap more symmetrically but three of them are longer than the rest
subplot(2,2,3);
hold on;
max_length = max(cellfun(@length, cycle_flows));
for i = 1:length(cycle_flows)
x = 1:max_length;
y = NaN(1, max_length); % Initialize with NaNs
y(1:length(cycle_flows{i})) = cycle_flows{i};
plot(x, y);
end
hold off; %this code works but not the way i want it, the cycles are supposted to overlap more symmetrically but three of them are longer than the rest
subplot(2,2,3);
hold on;
max_length = max(cellfun(@length, cycle_flows));
for i = 1:length(cycle_flows)
x = 1:max_length;
y = NaN(1, max_length); % Initialize with NaNs
y(1:length(cycle_flows{i})) = cycle_flows{i};
plot(x, y);
end
hold off; plotting, student MATLAB Answers — New Questions
I have an error with this code for different number of elements. I’m lost on how to fix it for the proper output.
clc;
clear all
close all
% Define the data points for the base excitation (modify these values as needed)
data = [0.0; 0.00571634384576599; 0.0172961399245937; 0.0215661733228299;
0.0138433053175935; 0.00475824598689792; 0.00940235333989425;
0.0298244388227628; 0.0502561943723699; 0.0516260538077677;
0.0311672997795811; 0.00657207675777726;
-0.00043850430233673; 0.0150661812622991; 0.0369781637016863;
0.0444861334353839; 0.032063551445643; 0.0130695841363085;
0.00450012342523607; 0.00980150594910536; 0.0175350556867159;
0.0158705130787799; 0.00603906690334467; 0.0];
% Sampling period (modify this value if needed)
T = pi/2; %seconds
% Number of data points
N = 24;
% Fundamental frequency (reciprocal of sampling period)
f0 = 1/T;
% Define the number of harmonics to consider (modify this value if needed)
numHarmonics = 4;
% Pre-allocate arrays for coefficients with correct sizes
a = zeros(1, numHarmonics+1);
b = zeros(1, numHarmonics);
% Calculate the constant term (a0)
a(1) = mean(data); % Assigning the average to the first element of a
% Calculate the coefficients for harmonics (a1 to aN and b1 to bN)
for n = 1:numHarmonics
% Calculate the cosine terms
cosine_terms = data .* cos(n*2*pi*f0*(0:N-1)/T);
% Calculate the sine terms (omit the first term for b because of symmetry)
sine_terms = data(2:end) .* sin(n*2*pi*f0*(1:N-1)/T);
% Apply integration by trapezoidal rule (assuming uniform sampling)
a(n+1) = (sum(cosine_terms) + cosine_terms(1)/2 + cosine_terms(end)/2) * 2/N;
b(n) = (sum(sine_terms) + sine_terms(1)/2) * 2/N;
end
% Display the Fourier Series Coefficients
fprintf(‘Fourier Series Coefficients:n’);
fprintf(‘a0 = %.4fn’, a(1));
for n = 1:numHarmonics
fprintf(‘a%d = %.4f, b%d = %.4fn’, n, a(n+1), n, b(n));
end
Output:
Unable to perform assignment because the left and right sides have a different number of elements.
Error in fouriercodething (line 40)
a(n+1) = (sum(cosine_terms) + cosine_terms(1)/2 + cosine_terms(end)/2) * 2/N;clc;
clear all
close all
% Define the data points for the base excitation (modify these values as needed)
data = [0.0; 0.00571634384576599; 0.0172961399245937; 0.0215661733228299;
0.0138433053175935; 0.00475824598689792; 0.00940235333989425;
0.0298244388227628; 0.0502561943723699; 0.0516260538077677;
0.0311672997795811; 0.00657207675777726;
-0.00043850430233673; 0.0150661812622991; 0.0369781637016863;
0.0444861334353839; 0.032063551445643; 0.0130695841363085;
0.00450012342523607; 0.00980150594910536; 0.0175350556867159;
0.0158705130787799; 0.00603906690334467; 0.0];
% Sampling period (modify this value if needed)
T = pi/2; %seconds
% Number of data points
N = 24;
% Fundamental frequency (reciprocal of sampling period)
f0 = 1/T;
% Define the number of harmonics to consider (modify this value if needed)
numHarmonics = 4;
% Pre-allocate arrays for coefficients with correct sizes
a = zeros(1, numHarmonics+1);
b = zeros(1, numHarmonics);
% Calculate the constant term (a0)
a(1) = mean(data); % Assigning the average to the first element of a
% Calculate the coefficients for harmonics (a1 to aN and b1 to bN)
for n = 1:numHarmonics
% Calculate the cosine terms
cosine_terms = data .* cos(n*2*pi*f0*(0:N-1)/T);
% Calculate the sine terms (omit the first term for b because of symmetry)
sine_terms = data(2:end) .* sin(n*2*pi*f0*(1:N-1)/T);
% Apply integration by trapezoidal rule (assuming uniform sampling)
a(n+1) = (sum(cosine_terms) + cosine_terms(1)/2 + cosine_terms(end)/2) * 2/N;
b(n) = (sum(sine_terms) + sine_terms(1)/2) * 2/N;
end
% Display the Fourier Series Coefficients
fprintf(‘Fourier Series Coefficients:n’);
fprintf(‘a0 = %.4fn’, a(1));
for n = 1:numHarmonics
fprintf(‘a%d = %.4f, b%d = %.4fn’, n, a(n+1), n, b(n));
end
Output:
Unable to perform assignment because the left and right sides have a different number of elements.
Error in fouriercodething (line 40)
a(n+1) = (sum(cosine_terms) + cosine_terms(1)/2 + cosine_terms(end)/2) * 2/N; clc;
clear all
close all
% Define the data points for the base excitation (modify these values as needed)
data = [0.0; 0.00571634384576599; 0.0172961399245937; 0.0215661733228299;
0.0138433053175935; 0.00475824598689792; 0.00940235333989425;
0.0298244388227628; 0.0502561943723699; 0.0516260538077677;
0.0311672997795811; 0.00657207675777726;
-0.00043850430233673; 0.0150661812622991; 0.0369781637016863;
0.0444861334353839; 0.032063551445643; 0.0130695841363085;
0.00450012342523607; 0.00980150594910536; 0.0175350556867159;
0.0158705130787799; 0.00603906690334467; 0.0];
% Sampling period (modify this value if needed)
T = pi/2; %seconds
% Number of data points
N = 24;
% Fundamental frequency (reciprocal of sampling period)
f0 = 1/T;
% Define the number of harmonics to consider (modify this value if needed)
numHarmonics = 4;
% Pre-allocate arrays for coefficients with correct sizes
a = zeros(1, numHarmonics+1);
b = zeros(1, numHarmonics);
% Calculate the constant term (a0)
a(1) = mean(data); % Assigning the average to the first element of a
% Calculate the coefficients for harmonics (a1 to aN and b1 to bN)
for n = 1:numHarmonics
% Calculate the cosine terms
cosine_terms = data .* cos(n*2*pi*f0*(0:N-1)/T);
% Calculate the sine terms (omit the first term for b because of symmetry)
sine_terms = data(2:end) .* sin(n*2*pi*f0*(1:N-1)/T);
% Apply integration by trapezoidal rule (assuming uniform sampling)
a(n+1) = (sum(cosine_terms) + cosine_terms(1)/2 + cosine_terms(end)/2) * 2/N;
b(n) = (sum(sine_terms) + sine_terms(1)/2) * 2/N;
end
% Display the Fourier Series Coefficients
fprintf(‘Fourier Series Coefficients:n’);
fprintf(‘a0 = %.4fn’, a(1));
for n = 1:numHarmonics
fprintf(‘a%d = %.4f, b%d = %.4fn’, n, a(n+1), n, b(n));
end
Output:
Unable to perform assignment because the left and right sides have a different number of elements.
Error in fouriercodething (line 40)
a(n+1) = (sum(cosine_terms) + cosine_terms(1)/2 + cosine_terms(end)/2) * 2/N; troubleshooting MATLAB Answers — New Questions
Using Multiple Classes/Files MATLAB
Hello,
I am having some trouble understanding object oriented progrraming in MATLAB.
I have created a script .m file which I want my general code to run in and produce the output(s) that I want.
I have also create three separate .m files, each of which contain three different classes, and these classes each have a constructor as well as a function which returns a public variable of the class which is initialized thru the constructor.
My goal is to create an instance of these three different classes in the script .m file as I earlier mentioned, as I want to access this public variable from each class in the main script file as it is needed to run my program/produce the output.
For reference, here is an example of the class I am talking about:
classdef className
properties
%general variables
%variable i want accessed the main script
end
methods
function r = className(%general variables)
%variable i want accessed=(math operation using general
%variables)
r=className
end
function randomName = randomName()
randomName=%variable i want accessed int he main script
end
end
endHello,
I am having some trouble understanding object oriented progrraming in MATLAB.
I have created a script .m file which I want my general code to run in and produce the output(s) that I want.
I have also create three separate .m files, each of which contain three different classes, and these classes each have a constructor as well as a function which returns a public variable of the class which is initialized thru the constructor.
My goal is to create an instance of these three different classes in the script .m file as I earlier mentioned, as I want to access this public variable from each class in the main script file as it is needed to run my program/produce the output.
For reference, here is an example of the class I am talking about:
classdef className
properties
%general variables
%variable i want accessed the main script
end
methods
function r = className(%general variables)
%variable i want accessed=(math operation using general
%variables)
r=className
end
function randomName = randomName()
randomName=%variable i want accessed int he main script
end
end
end Hello,
I am having some trouble understanding object oriented progrraming in MATLAB.
I have created a script .m file which I want my general code to run in and produce the output(s) that I want.
I have also create three separate .m files, each of which contain three different classes, and these classes each have a constructor as well as a function which returns a public variable of the class which is initialized thru the constructor.
My goal is to create an instance of these three different classes in the script .m file as I earlier mentioned, as I want to access this public variable from each class in the main script file as it is needed to run my program/produce the output.
For reference, here is an example of the class I am talking about:
classdef className
properties
%general variables
%variable i want accessed the main script
end
methods
function r = className(%general variables)
%variable i want accessed=(math operation using general
%variables)
r=className
end
function randomName = randomName()
randomName=%variable i want accessed int he main script
end
end
end class, function, matlab MATLAB Answers — New Questions
How can I filter the white noise from a wav file using the filter designer tool in matlab
How can I filter the white noise from a wav file using the filter designer tool in matlab. I am using the low pass filter to filter it but the noise is not attenuated. I have attached the audio files.How can I filter the white noise from a wav file using the filter designer tool in matlab. I am using the low pass filter to filter it but the noise is not attenuated. I have attached the audio files. How can I filter the white noise from a wav file using the filter designer tool in matlab. I am using the low pass filter to filter it but the noise is not attenuated. I have attached the audio files. filter MATLAB Answers — New Questions
System Identification – Matlab 2023a not launching
I am using a student licensed Matlab version 2023a. The license allows me to install System Identification toolbox. Currently, the toolbox is not opening. As I click on it through Apps panel or using the command systemidentification in command window, the app does not open.
I am pretty sure that the app is installed because I can see it in the Apps panel and when I use ‘ver’ (below you can find the list of all toolboxes) it shows that it exists. I have already tried to uninstall the app and install it back but this did not solve the issue.
Your help is much appreciated. Thanks in advance.
—————————————————————————————————–
MATLAB Version: 9.14.0.2337262 (R2023a) Update 5
MATLAB License Number: ——
Operating System: —–
Java Version: Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
—————————————————————————————————–
MATLAB Version 9.14 (R2023a)
Simulink Version 10.7 (R2023a)
Aerospace Blockset Version 6.0 (R2023a)
Aerospace Toolbox Version 4.4 (R2023a)
Communications Toolbox Version 8.0 (R2023a)
Computer Vision Toolbox Version 10.4 (R2023a)
Control System Toolbox Version 10.13 (R2023a)
Curve Fitting Toolbox Version 3.9 (R2023a)
DSP System Toolbox Version 9.16 (R2023a)
Database Toolbox Version 11.0 (R2023a)
Deep Learning HDL Toolbox Version 1.5 (R2023a)
Deep Learning Toolbox Version 14.6 (R2023a)
Econometrics Toolbox Version 6.2 (R2023a)
Embedded Coder Version 7.10 (R2023a)
GUI Layout Toolbox Version 2.3.1 (R2016b)
GUI Layout Toolbox Version 2.3.6 (R2023a)
Global Optimization Toolbox Version 4.8.1 (R2023a)
Image Processing Toolbox Version 11.7 (R2023a)
MATLAB Coder Version 5.6 (R2023a)
MATLAB Compiler Version 8.6 (R2023a)
MATLAB Compiler SDK Version 7.2 (R2023a)
MATLAB Report Generator Version 5.14 (R2023a)
MATLAB Test Version 1.0 (R2023a)
Mapping Toolbox Version 5.5 (R2023a)
Mixed-Signal Blockset Version 2.4 (R2023a)
Model Predictive Control Toolbox Version 8.1 (R2023a)
Model-Based Calibration Toolbox Version 5.14 (R2023a)
Motor Control Blockset Version 2.0 (R2023a)
Navigation Toolbox Version 2.4 (R2023a)
Optimization Toolbox Version 9.5 (R2023a)
Parallel Computing Toolbox Version 7.8 (R2023a)
ROS Toolbox Version 2.0 (R2023a)
Signal Processing Toolbox Version 9.2 (R2023a)
Simscape Version 5.5 (R2023a)
Simulink 3D Animation Version 9.6 (R2023a)
Simulink Check Version 6.2 (R2023a)
Simulink Code Inspector Version 4.3 (R2023a)
Simulink Coder Version 9.9 (R2023a)
Simulink Compiler Version 1.6 (R2023a)
Simulink Control Design Version 7.0 (R2023a)
Simulink Coverage Version 5.6 (R2023a)
Simulink Design Optimization Version 3.13 (R2023a)
Simulink Design Verifier Version 4.9 (R2023a)
Simulink Desktop Real-Time Version 5.16 (R2023a)
Simulink PLC Coder Version 3.8 (R2023a)
Simulink Real-Time Version 8.2 (R2023a)
Simulink Report Generator Version 5.14 (R2023a)
Simulink Test Version 3.8 (R2023a)
SoC Blockset Version 1.8 (R2023a)
Spreadsheet Link Version 3.4.9 (R2023a)
Stateflow Version 10.8 (R2023a)
Statistics and Machine Learning Toolbox Version 12.5 (R2023a)
Symbolic Math Toolbox Version 9.3 (R2023a)
System Composer Version 2.4 (R2023a)
System Identification Toolbox Version 10.1 (R2023a)
Text Analytics Toolbox Version 1.10 (R2023a)
UAV Toolbox Version 1.5 (R2023a)
Vehicle Dynamics Blockset Version 2.0 (R2023a)I am using a student licensed Matlab version 2023a. The license allows me to install System Identification toolbox. Currently, the toolbox is not opening. As I click on it through Apps panel or using the command systemidentification in command window, the app does not open.
I am pretty sure that the app is installed because I can see it in the Apps panel and when I use ‘ver’ (below you can find the list of all toolboxes) it shows that it exists. I have already tried to uninstall the app and install it back but this did not solve the issue.
Your help is much appreciated. Thanks in advance.
—————————————————————————————————–
MATLAB Version: 9.14.0.2337262 (R2023a) Update 5
MATLAB License Number: ——
Operating System: —–
Java Version: Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
—————————————————————————————————–
MATLAB Version 9.14 (R2023a)
Simulink Version 10.7 (R2023a)
Aerospace Blockset Version 6.0 (R2023a)
Aerospace Toolbox Version 4.4 (R2023a)
Communications Toolbox Version 8.0 (R2023a)
Computer Vision Toolbox Version 10.4 (R2023a)
Control System Toolbox Version 10.13 (R2023a)
Curve Fitting Toolbox Version 3.9 (R2023a)
DSP System Toolbox Version 9.16 (R2023a)
Database Toolbox Version 11.0 (R2023a)
Deep Learning HDL Toolbox Version 1.5 (R2023a)
Deep Learning Toolbox Version 14.6 (R2023a)
Econometrics Toolbox Version 6.2 (R2023a)
Embedded Coder Version 7.10 (R2023a)
GUI Layout Toolbox Version 2.3.1 (R2016b)
GUI Layout Toolbox Version 2.3.6 (R2023a)
Global Optimization Toolbox Version 4.8.1 (R2023a)
Image Processing Toolbox Version 11.7 (R2023a)
MATLAB Coder Version 5.6 (R2023a)
MATLAB Compiler Version 8.6 (R2023a)
MATLAB Compiler SDK Version 7.2 (R2023a)
MATLAB Report Generator Version 5.14 (R2023a)
MATLAB Test Version 1.0 (R2023a)
Mapping Toolbox Version 5.5 (R2023a)
Mixed-Signal Blockset Version 2.4 (R2023a)
Model Predictive Control Toolbox Version 8.1 (R2023a)
Model-Based Calibration Toolbox Version 5.14 (R2023a)
Motor Control Blockset Version 2.0 (R2023a)
Navigation Toolbox Version 2.4 (R2023a)
Optimization Toolbox Version 9.5 (R2023a)
Parallel Computing Toolbox Version 7.8 (R2023a)
ROS Toolbox Version 2.0 (R2023a)
Signal Processing Toolbox Version 9.2 (R2023a)
Simscape Version 5.5 (R2023a)
Simulink 3D Animation Version 9.6 (R2023a)
Simulink Check Version 6.2 (R2023a)
Simulink Code Inspector Version 4.3 (R2023a)
Simulink Coder Version 9.9 (R2023a)
Simulink Compiler Version 1.6 (R2023a)
Simulink Control Design Version 7.0 (R2023a)
Simulink Coverage Version 5.6 (R2023a)
Simulink Design Optimization Version 3.13 (R2023a)
Simulink Design Verifier Version 4.9 (R2023a)
Simulink Desktop Real-Time Version 5.16 (R2023a)
Simulink PLC Coder Version 3.8 (R2023a)
Simulink Real-Time Version 8.2 (R2023a)
Simulink Report Generator Version 5.14 (R2023a)
Simulink Test Version 3.8 (R2023a)
SoC Blockset Version 1.8 (R2023a)
Spreadsheet Link Version 3.4.9 (R2023a)
Stateflow Version 10.8 (R2023a)
Statistics and Machine Learning Toolbox Version 12.5 (R2023a)
Symbolic Math Toolbox Version 9.3 (R2023a)
System Composer Version 2.4 (R2023a)
System Identification Toolbox Version 10.1 (R2023a)
Text Analytics Toolbox Version 1.10 (R2023a)
UAV Toolbox Version 1.5 (R2023a)
Vehicle Dynamics Blockset Version 2.0 (R2023a) I am using a student licensed Matlab version 2023a. The license allows me to install System Identification toolbox. Currently, the toolbox is not opening. As I click on it through Apps panel or using the command systemidentification in command window, the app does not open.
I am pretty sure that the app is installed because I can see it in the Apps panel and when I use ‘ver’ (below you can find the list of all toolboxes) it shows that it exists. I have already tried to uninstall the app and install it back but this did not solve the issue.
Your help is much appreciated. Thanks in advance.
—————————————————————————————————–
MATLAB Version: 9.14.0.2337262 (R2023a) Update 5
MATLAB License Number: ——
Operating System: —–
Java Version: Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
—————————————————————————————————–
MATLAB Version 9.14 (R2023a)
Simulink Version 10.7 (R2023a)
Aerospace Blockset Version 6.0 (R2023a)
Aerospace Toolbox Version 4.4 (R2023a)
Communications Toolbox Version 8.0 (R2023a)
Computer Vision Toolbox Version 10.4 (R2023a)
Control System Toolbox Version 10.13 (R2023a)
Curve Fitting Toolbox Version 3.9 (R2023a)
DSP System Toolbox Version 9.16 (R2023a)
Database Toolbox Version 11.0 (R2023a)
Deep Learning HDL Toolbox Version 1.5 (R2023a)
Deep Learning Toolbox Version 14.6 (R2023a)
Econometrics Toolbox Version 6.2 (R2023a)
Embedded Coder Version 7.10 (R2023a)
GUI Layout Toolbox Version 2.3.1 (R2016b)
GUI Layout Toolbox Version 2.3.6 (R2023a)
Global Optimization Toolbox Version 4.8.1 (R2023a)
Image Processing Toolbox Version 11.7 (R2023a)
MATLAB Coder Version 5.6 (R2023a)
MATLAB Compiler Version 8.6 (R2023a)
MATLAB Compiler SDK Version 7.2 (R2023a)
MATLAB Report Generator Version 5.14 (R2023a)
MATLAB Test Version 1.0 (R2023a)
Mapping Toolbox Version 5.5 (R2023a)
Mixed-Signal Blockset Version 2.4 (R2023a)
Model Predictive Control Toolbox Version 8.1 (R2023a)
Model-Based Calibration Toolbox Version 5.14 (R2023a)
Motor Control Blockset Version 2.0 (R2023a)
Navigation Toolbox Version 2.4 (R2023a)
Optimization Toolbox Version 9.5 (R2023a)
Parallel Computing Toolbox Version 7.8 (R2023a)
ROS Toolbox Version 2.0 (R2023a)
Signal Processing Toolbox Version 9.2 (R2023a)
Simscape Version 5.5 (R2023a)
Simulink 3D Animation Version 9.6 (R2023a)
Simulink Check Version 6.2 (R2023a)
Simulink Code Inspector Version 4.3 (R2023a)
Simulink Coder Version 9.9 (R2023a)
Simulink Compiler Version 1.6 (R2023a)
Simulink Control Design Version 7.0 (R2023a)
Simulink Coverage Version 5.6 (R2023a)
Simulink Design Optimization Version 3.13 (R2023a)
Simulink Design Verifier Version 4.9 (R2023a)
Simulink Desktop Real-Time Version 5.16 (R2023a)
Simulink PLC Coder Version 3.8 (R2023a)
Simulink Real-Time Version 8.2 (R2023a)
Simulink Report Generator Version 5.14 (R2023a)
Simulink Test Version 3.8 (R2023a)
SoC Blockset Version 1.8 (R2023a)
Spreadsheet Link Version 3.4.9 (R2023a)
Stateflow Version 10.8 (R2023a)
Statistics and Machine Learning Toolbox Version 12.5 (R2023a)
Symbolic Math Toolbox Version 9.3 (R2023a)
System Composer Version 2.4 (R2023a)
System Identification Toolbox Version 10.1 (R2023a)
Text Analytics Toolbox Version 1.10 (R2023a)
UAV Toolbox Version 1.5 (R2023a)
Vehicle Dynamics Blockset Version 2.0 (R2023a) system identification, matlab toolbox MATLAB Answers — New Questions
Running main model with fixed step solver and subsystem with variable step solver
My aim is to integrate a Simulink protected model which runs on variable step solver with our vehicle plant model which runs on Fixed step solver ode1 with a time step of 1ms. I would like to know if it is possible to do the same. Any ideas would be appreciated.My aim is to integrate a Simulink protected model which runs on variable step solver with our vehicle plant model which runs on Fixed step solver ode1 with a time step of 1ms. I would like to know if it is possible to do the same. Any ideas would be appreciated. My aim is to integrate a Simulink protected model which runs on variable step solver with our vehicle plant model which runs on Fixed step solver ode1 with a time step of 1ms. I would like to know if it is possible to do the same. Any ideas would be appreciated. solver, fixedstepsolver, variablestepsolver MATLAB Answers — New Questions
Problem with pidtune function
For the following code I keep getting just an integral element to my controller even though I am specifying PID. I need PID to get the response I’m looking for but unsure of what I’m doing wrong. tfp4 comes from a state space which I am sure is correct and isn’t causing any errors that should effect my response.
[C,info] = pidtune(tfp4, ‘PID’)
tuned = feedback(C*tfp4, 1);
t = linspace(0, 100, 1000);
u = 3*pi/180*heaviside(t);
[y42, t42] = lsim(tuned, u, t);
y42 = y42*180/pi;
figure()
plot(t42, y42)For the following code I keep getting just an integral element to my controller even though I am specifying PID. I need PID to get the response I’m looking for but unsure of what I’m doing wrong. tfp4 comes from a state space which I am sure is correct and isn’t causing any errors that should effect my response.
[C,info] = pidtune(tfp4, ‘PID’)
tuned = feedback(C*tfp4, 1);
t = linspace(0, 100, 1000);
u = 3*pi/180*heaviside(t);
[y42, t42] = lsim(tuned, u, t);
y42 = y42*180/pi;
figure()
plot(t42, y42) For the following code I keep getting just an integral element to my controller even though I am specifying PID. I need PID to get the response I’m looking for but unsure of what I’m doing wrong. tfp4 comes from a state space which I am sure is correct and isn’t causing any errors that should effect my response.
[C,info] = pidtune(tfp4, ‘PID’)
tuned = feedback(C*tfp4, 1);
t = linspace(0, 100, 1000);
u = 3*pi/180*heaviside(t);
[y42, t42] = lsim(tuned, u, t);
y42 = y42*180/pi;
figure()
plot(t42, y42) control, pid controller MATLAB Answers — New Questions
How to plot isosurface of for a wide range of values
I wish to plot isosurface of my data, But in a wide range of values. For example, MathWork has introduced the following example for one-value isosurface in its help:
[x,y,z,v] = flow;
p = patch(isosurface(x,y,z,v,-3));
isonormals(x,y,z,v,p)
p.FaceColor = ‘red’;
p.EdgeColor = ‘none’;
daspect([1 1 1])
view(3);
axis tight
camlight
lighting gouraud
The above example, will plot "flow" data if their "v" values is equal to -3.
What I want to do, is that I want to plot my data like "flow", which their "v" values are higher than -3, not exactly equal to -3.I wish to plot isosurface of my data, But in a wide range of values. For example, MathWork has introduced the following example for one-value isosurface in its help:
[x,y,z,v] = flow;
p = patch(isosurface(x,y,z,v,-3));
isonormals(x,y,z,v,p)
p.FaceColor = ‘red’;
p.EdgeColor = ‘none’;
daspect([1 1 1])
view(3);
axis tight
camlight
lighting gouraud
The above example, will plot "flow" data if their "v" values is equal to -3.
What I want to do, is that I want to plot my data like "flow", which their "v" values are higher than -3, not exactly equal to -3. I wish to plot isosurface of my data, But in a wide range of values. For example, MathWork has introduced the following example for one-value isosurface in its help:
[x,y,z,v] = flow;
p = patch(isosurface(x,y,z,v,-3));
isonormals(x,y,z,v,p)
p.FaceColor = ‘red’;
p.EdgeColor = ‘none’;
daspect([1 1 1])
view(3);
axis tight
camlight
lighting gouraud
The above example, will plot "flow" data if their "v" values is equal to -3.
What I want to do, is that I want to plot my data like "flow", which their "v" values are higher than -3, not exactly equal to -3. isosurface, 3d plots, volume plot, matlab MATLAB Answers — New Questions
Single-panel app with reflow?
The flexibility that comes with reflow is a really desirable feature. But why can’t I convert my app designer app to a single panel app with auto reflow? It would be completely adequate, and it would prevent the squishing of my layout that occurs in the current conversion method. Please, please, add this!The flexibility that comes with reflow is a really desirable feature. But why can’t I convert my app designer app to a single panel app with auto reflow? It would be completely adequate, and it would prevent the squishing of my layout that occurs in the current conversion method. Please, please, add this! The flexibility that comes with reflow is a really desirable feature. But why can’t I convert my app designer app to a single panel app with auto reflow? It would be completely adequate, and it would prevent the squishing of my layout that occurs in the current conversion method. Please, please, add this! appdesigner MATLAB Answers — New Questions
what block does simulink C2000 code generation supported?
Hi!
I have a question regarding the simulink C2000 code generation. I know some simple block such as some math operator like add, subtract, multiply, and integral are supported by the c2000 code generation. I want to know more about how many other block are also support by the code generation but I cannot find any material talk about it. I want to know is there any material can find out the answer to my question.Hi!
I have a question regarding the simulink C2000 code generation. I know some simple block such as some math operator like add, subtract, multiply, and integral are supported by the c2000 code generation. I want to know more about how many other block are also support by the code generation but I cannot find any material talk about it. I want to know is there any material can find out the answer to my question. Hi!
I have a question regarding the simulink C2000 code generation. I know some simple block such as some math operator like add, subtract, multiply, and integral are supported by the c2000 code generation. I want to know more about how many other block are also support by the code generation but I cannot find any material talk about it. I want to know is there any material can find out the answer to my question. c2000, simulink, c2000 code generation, 28379d MATLAB Answers — New Questions
Running Matlab R2024a in conjunction with Oracle JRE 8 Java ( native Apple Silicon version)
I just upgraded to Matlab R2024a and also installed Java amazon-corretto-11.jdk as part of the installation.
I am using a 3rd party software which interacts with Matlab through Java which now causes issues due to the use of Corretto. I was recommended to switch to Oracle JRE 8 to solve the problem.
Is anybody here successfully running Matlab R2024a for native Apple M1 chip in conjunction with Oracle JRE 8?
On the Oracle download ( https://www.oracle.com/au/java/technologies/downloads/ ) page there are several options for Java 8. I used the ARM64 DMG installer which then shows the following version on my mac:
1.8.0_411 (arm64) "Oracle Corporation" – "Java SE 8" /Library/Java/JavaVirtualMachines/jdk-1.8.jdk/Contents/Home
I also created a java.opts file with the following content:
-Djava.home=/Library/Java/JavaVirtualMachines/jdk-1.8.jdk/Contents/Home
and stored it in /Applications/MATLAB_R2024a.app/bin/maca64/
Now Matlab R2024a is not starting up any more.
Does anybody have any recommendations?I just upgraded to Matlab R2024a and also installed Java amazon-corretto-11.jdk as part of the installation.
I am using a 3rd party software which interacts with Matlab through Java which now causes issues due to the use of Corretto. I was recommended to switch to Oracle JRE 8 to solve the problem.
Is anybody here successfully running Matlab R2024a for native Apple M1 chip in conjunction with Oracle JRE 8?
On the Oracle download ( https://www.oracle.com/au/java/technologies/downloads/ ) page there are several options for Java 8. I used the ARM64 DMG installer which then shows the following version on my mac:
1.8.0_411 (arm64) "Oracle Corporation" – "Java SE 8" /Library/Java/JavaVirtualMachines/jdk-1.8.jdk/Contents/Home
I also created a java.opts file with the following content:
-Djava.home=/Library/Java/JavaVirtualMachines/jdk-1.8.jdk/Contents/Home
and stored it in /Applications/MATLAB_R2024a.app/bin/maca64/
Now Matlab R2024a is not starting up any more.
Does anybody have any recommendations? I just upgraded to Matlab R2024a and also installed Java amazon-corretto-11.jdk as part of the installation.
I am using a 3rd party software which interacts with Matlab through Java which now causes issues due to the use of Corretto. I was recommended to switch to Oracle JRE 8 to solve the problem.
Is anybody here successfully running Matlab R2024a for native Apple M1 chip in conjunction with Oracle JRE 8?
On the Oracle download ( https://www.oracle.com/au/java/technologies/downloads/ ) page there are several options for Java 8. I used the ARM64 DMG installer which then shows the following version on my mac:
1.8.0_411 (arm64) "Oracle Corporation" – "Java SE 8" /Library/Java/JavaVirtualMachines/jdk-1.8.jdk/Contents/Home
I also created a java.opts file with the following content:
-Djava.home=/Library/Java/JavaVirtualMachines/jdk-1.8.jdk/Contents/Home
and stored it in /Applications/MATLAB_R2024a.app/bin/maca64/
Now Matlab R2024a is not starting up any more.
Does anybody have any recommendations? native apple, apple m1, java, oracle jre8, matlab r2024a MATLAB Answers — New Questions
Error Using Optimization with Integer Variables and Non-linear Constraints
Hi guys! I would be very grateful if you could help me!
I’m trying to minimize the norm of a vector using optimization algorithms in MATLAB, but I’m getting an error that says "Problems with integer variables and nonlinear equality constraints are not supported."
Could someone help me understand how I can solve this and minimize the norm of the vector?
Here’s the implemented code:
wpass = 0.0318*pi;
wstop = 0.15*pi;
pb_ripple = 0.03;
sb_ripple = 0.03;
n = 25;
l = 7;
k = 2^l;
N = 15*n;
w = linspace(0,pi,N);
A = [ones(N,1) 2*cos(kron(w’,1:n))];
Ap = A((0 <= w) & (w <= wpass),:);
As = A((wstop <= w) & (w <= pi),:);
H_dac=sinc(w);
H_dac_p=H_dac(1,(0 <= w) & (w <= wpass));
H_dac_s=H_dac(1,(wstop <= w) & (w <= pi));
h = optimvar(‘h’,(n+1), ‘Type’,’integer’,’LowerBound’,-inf,’UpperBound’,inf);
norm_h=optimvar(‘norm_h’,’Type’,’integer’);
prob = optimproblem(‘ObjectiveSense’,’minimize’);
prob.Constraints.cons1 = norm_h==norm(cat(1,h(end:-1:2),h),1);
prob.Objective = norm_h;
prob.Constraints.cons2 = Ap*h <= k*(1 + pb_ripple);
prob.Constraints.cons3 = Ap*h >= k*(1 – pb_ripple);
prob.Constraints.cons4 = As*h <= k*(sb_ripple);
prob.Constraints.cons5 = As*h >= -k*(sb_ripple);
sol = solve(prob);Hi guys! I would be very grateful if you could help me!
I’m trying to minimize the norm of a vector using optimization algorithms in MATLAB, but I’m getting an error that says "Problems with integer variables and nonlinear equality constraints are not supported."
Could someone help me understand how I can solve this and minimize the norm of the vector?
Here’s the implemented code:
wpass = 0.0318*pi;
wstop = 0.15*pi;
pb_ripple = 0.03;
sb_ripple = 0.03;
n = 25;
l = 7;
k = 2^l;
N = 15*n;
w = linspace(0,pi,N);
A = [ones(N,1) 2*cos(kron(w’,1:n))];
Ap = A((0 <= w) & (w <= wpass),:);
As = A((wstop <= w) & (w <= pi),:);
H_dac=sinc(w);
H_dac_p=H_dac(1,(0 <= w) & (w <= wpass));
H_dac_s=H_dac(1,(wstop <= w) & (w <= pi));
h = optimvar(‘h’,(n+1), ‘Type’,’integer’,’LowerBound’,-inf,’UpperBound’,inf);
norm_h=optimvar(‘norm_h’,’Type’,’integer’);
prob = optimproblem(‘ObjectiveSense’,’minimize’);
prob.Constraints.cons1 = norm_h==norm(cat(1,h(end:-1:2),h),1);
prob.Objective = norm_h;
prob.Constraints.cons2 = Ap*h <= k*(1 + pb_ripple);
prob.Constraints.cons3 = Ap*h >= k*(1 – pb_ripple);
prob.Constraints.cons4 = As*h <= k*(sb_ripple);
prob.Constraints.cons5 = As*h >= -k*(sb_ripple);
sol = solve(prob); Hi guys! I would be very grateful if you could help me!
I’m trying to minimize the norm of a vector using optimization algorithms in MATLAB, but I’m getting an error that says "Problems with integer variables and nonlinear equality constraints are not supported."
Could someone help me understand how I can solve this and minimize the norm of the vector?
Here’s the implemented code:
wpass = 0.0318*pi;
wstop = 0.15*pi;
pb_ripple = 0.03;
sb_ripple = 0.03;
n = 25;
l = 7;
k = 2^l;
N = 15*n;
w = linspace(0,pi,N);
A = [ones(N,1) 2*cos(kron(w’,1:n))];
Ap = A((0 <= w) & (w <= wpass),:);
As = A((wstop <= w) & (w <= pi),:);
H_dac=sinc(w);
H_dac_p=H_dac(1,(0 <= w) & (w <= wpass));
H_dac_s=H_dac(1,(wstop <= w) & (w <= pi));
h = optimvar(‘h’,(n+1), ‘Type’,’integer’,’LowerBound’,-inf,’UpperBound’,inf);
norm_h=optimvar(‘norm_h’,’Type’,’integer’);
prob = optimproblem(‘ObjectiveSense’,’minimize’);
prob.Constraints.cons1 = norm_h==norm(cat(1,h(end:-1:2),h),1);
prob.Objective = norm_h;
prob.Constraints.cons2 = Ap*h <= k*(1 + pb_ripple);
prob.Constraints.cons3 = Ap*h >= k*(1 – pb_ripple);
prob.Constraints.cons4 = As*h <= k*(sb_ripple);
prob.Constraints.cons5 = As*h >= -k*(sb_ripple);
sol = solve(prob); optimization, minimize MATLAB Answers — New Questions
Upload custom flight controller on Pixhawk 4, and flight tests
Hello.
I developed my flight controller in simulink, and i tested it In SIL, HITL following the matlab examples https://it.mathworks.com/help/supportpkg/px4/setup-and-configuration_mw_3095a711-0234-45ed-9b75-77488e8e577d.html https://it.mathworks.com/help/supportpkg/px4/setup-and-configuration_mw_06fa168c-661f-4e54-b3b0-197c970f0ac9.htm . Now i want try to perform the flight test with my fligth controller. Now, there isn’t any examples about perform real fligth tests. So, I uploaded the firmware following the HIL procedure:
Build the firmware and upload
Default startup script
Design flight controller in simulink
Boardo Pixhawk 4, whit px4_fmu-v5_default
Then after these passages i Build Start and deploy my fligth controller into Pixhawk 4.
Now if i try to connect my drone with Qground cotnrol station, all the sensors, frame, GPS, ecc… are ok. So I armed the drone and command the take off, but the motors didn’t start to spinn. I also tried with the example in matlab "px4demo_HardwareInLoopWithSimulinkPlantStart", but even this dind’t work. A strange thing is that when i armed and command the take off, i saw (in Qg mavlink inspector) that the actuator_commands change his values to 2000 us, but the engines doesn’t move ( i use the PWM channel block). I alredy cheked that all the wires are connected, and also i tesed the engines via Qg and they works. So I guess that i miss something in the configuration for perform real fligth.
I also tried to uplod custom startup script, but i didn’t undestand very well the procedure. But in any case the default script should work, because it already disable the mc_postion_controller, and mc_attitude_controller.
I anyone have some guides to follow, or some adevices. Thanks in advance.Hello.
I developed my flight controller in simulink, and i tested it In SIL, HITL following the matlab examples https://it.mathworks.com/help/supportpkg/px4/setup-and-configuration_mw_3095a711-0234-45ed-9b75-77488e8e577d.html https://it.mathworks.com/help/supportpkg/px4/setup-and-configuration_mw_06fa168c-661f-4e54-b3b0-197c970f0ac9.htm . Now i want try to perform the flight test with my fligth controller. Now, there isn’t any examples about perform real fligth tests. So, I uploaded the firmware following the HIL procedure:
Build the firmware and upload
Default startup script
Design flight controller in simulink
Boardo Pixhawk 4, whit px4_fmu-v5_default
Then after these passages i Build Start and deploy my fligth controller into Pixhawk 4.
Now if i try to connect my drone with Qground cotnrol station, all the sensors, frame, GPS, ecc… are ok. So I armed the drone and command the take off, but the motors didn’t start to spinn. I also tried with the example in matlab "px4demo_HardwareInLoopWithSimulinkPlantStart", but even this dind’t work. A strange thing is that when i armed and command the take off, i saw (in Qg mavlink inspector) that the actuator_commands change his values to 2000 us, but the engines doesn’t move ( i use the PWM channel block). I alredy cheked that all the wires are connected, and also i tesed the engines via Qg and they works. So I guess that i miss something in the configuration for perform real fligth.
I also tried to uplod custom startup script, but i didn’t undestand very well the procedure. But in any case the default script should work, because it already disable the mc_postion_controller, and mc_attitude_controller.
I anyone have some guides to follow, or some adevices. Thanks in advance. Hello.
I developed my flight controller in simulink, and i tested it In SIL, HITL following the matlab examples https://it.mathworks.com/help/supportpkg/px4/setup-and-configuration_mw_3095a711-0234-45ed-9b75-77488e8e577d.html https://it.mathworks.com/help/supportpkg/px4/setup-and-configuration_mw_06fa168c-661f-4e54-b3b0-197c970f0ac9.htm . Now i want try to perform the flight test with my fligth controller. Now, there isn’t any examples about perform real fligth tests. So, I uploaded the firmware following the HIL procedure:
Build the firmware and upload
Default startup script
Design flight controller in simulink
Boardo Pixhawk 4, whit px4_fmu-v5_default
Then after these passages i Build Start and deploy my fligth controller into Pixhawk 4.
Now if i try to connect my drone with Qground cotnrol station, all the sensors, frame, GPS, ecc… are ok. So I armed the drone and command the take off, but the motors didn’t start to spinn. I also tried with the example in matlab "px4demo_HardwareInLoopWithSimulinkPlantStart", but even this dind’t work. A strange thing is that when i armed and command the take off, i saw (in Qg mavlink inspector) that the actuator_commands change his values to 2000 us, but the engines doesn’t move ( i use the PWM channel block). I alredy cheked that all the wires are connected, and also i tesed the engines via Qg and they works. So I guess that i miss something in the configuration for perform real fligth.
I also tried to uplod custom startup script, but i didn’t undestand very well the procedure. But in any case the default script should work, because it already disable the mc_postion_controller, and mc_attitude_controller.
I anyone have some guides to follow, or some adevices. Thanks in advance. uav toolbox support package for px4 autopilots, px4, flight tests MATLAB Answers — New Questions
GPS and IMU DATA FUSION FOR POSITION ESTIMATION
good morning, everyone.
i am working on a project to reconstruct a route using data from two sensors: gps and imu. I am working with two arduino boards, on one is integrated the imu while the gps is connected to the other board.
The sensor data is saved to two csv files which I then use in matlab.
The matlab code I have developed is as follows: I load the data from the gps and the imu and implement an extended kalman filter with the nonholonomic filter.
clear;
% carico dati del GPS
data_gps = load(‘C:UsersalberOneDriveDesktopTESIPROVE_CAMPUS14-01 (casa)output_gga.csv’);
% LATITUDINE, LONGITUDINE E ALTITUDINE
latitudine = data_gps(:,1);
longitudine = data_gps(:,2);
altitudine = data_gps(:,3);
time_gps = data_gps(:,4);
origine = [latitudine(1) longitudine(1) altitudine(1)];
%converti in coordinate locali
[xEast, yNorth, zUp] = latlon2local(latitudine, longitudine, altitudine, origine);
% converto il tempo del gps in secondi
tempi_gps_csv = num2str(time_gps);
ore = str2num(tempi_gps_csv(:,1:2));
minuti = str2num(tempi_gps_csv(:,3:4));
secondi = str2num(tempi_gps_csv(:,5:6));
tempi_secondi = ore*3600 + minuti*60 + secondi;
tempo_inizio = tempi_secondi(1);
tempi_gps = tempi_secondi – tempo_inizio;
% carico dati della IMU
data_imu = load(‘C:UsersalberOneDriveDesktopTESIPROVE_CAMPUS14-01 (casa)IMU.csv’);
N = length(data_imu);
accx_origin = data_imu(1:N,1);
accy_origin = data_imu(1:N,2);
accz_origin = data_imu(1:N,3);
acc_tot_origin = [accx_origin accy_origin accz_origin];
gyrox_origin = data_imu(1:N,4);
gyroy_origin = data_imu(1:N,5);
gyroz_origin = data_imu(1:N,6);
gyro_tot_origin = [gyrox_origin gyroy_origin gyroz_origin];
time_imu = data_imu(1:N,7);
% CONVERTO I DATI DI ACCELEROMETRO E GIROSCOPIO
% converto ‘deg/s’ to ‘rad/s’
gyro_tot_rad = convangvel(gyro_tot_origin, ‘deg/s’, ‘rad/s’);
% converto ‘g’ in ‘m/s^2’
acc_tot_meter = convacc(acc_tot_origin, ‘G”s’, ‘m/s^2’);
%converto il tempo della imu in secondi
tempi_imu_csv = num2str(floor(time_imu));
ore = str2num(tempi_imu_csv(:,1:2));
minuti = str2num(tempi_imu_csv(:,3:4));
secondi = str2num(tempi_imu_csv(:,5:6));
tempi_imu = ore*3600 + minuti*60 + secondi + mod(time_imu,1);
tempi_imu = tempi_imu – tempo_inizio;
% vettore tempi per l’operazione di interpolazione
tempo_desiderato = (tempi_imu(1):0.01:tempi_imu(end))’;
% ——— INTERPOLAZIONE ———–
accx = interp1(tempi_imu, acc_tot_meter(:,1), tempo_desiderato); %la time_imu sarebbe il ‘utc.delta_millis’ che calcolo
accy = interp1(tempi_imu, acc_tot_meter(:,2), tempo_desiderato);
accz = interp1(tempi_imu, acc_tot_meter(:,3), tempo_desiderato);
acc_tot = [accx accy accz];
% gyrox = interp1(time_imu, gyrox_origin, tempo_desiderato);
% gyroy = interp1(time_imu, gyroy_origin, tempo_desiderato);
% gyroz = interp1(time_imu, gyroz_origin, tempo_desiderato);
gyrox = interp1(tempi_imu, gyro_tot_rad(:,1), tempo_desiderato);
gyroy = interp1(tempi_imu, gyro_tot_rad(:,2), tempo_desiderato);
gyroz = interp1(tempi_imu, gyro_tot_rad(:,3), tempo_desiderato);
gyro_tot = [gyrox gyroy gyroz];
% vado ad interpolare anche le coord del gps
lat_interp = interp1(tempi_gps, latitudine, tempo_desiderato);
lon_interp = interp1(tempi_gps, longitudine, tempo_desiderato);
alt_interp = interp1(tempi_gps, altitudine, tempo_desiderato);
length_imu = length(acc_tot); %numero di elementi sul file csv
length_gps = length(data_gps);
% —————— IMU FILTER ———————–
fuse = imufilter(‘ReferenceFrame’, ‘NED’,’SampleRate’, 100,’GyroscopeNoise’, 0.0597, ‘AccelerometerNoise’, 3.8416e-04);
[orientazione ,angVelBodyRecovered] = fuse(acc_tot, gyro_tot);
% Plot Euler angles in degrees
A = eulerd(orientazione, ‘ZYX’, ‘frame’);
plot(eulerd(orientazione, ‘ZYX’, ‘frame’));
title(‘Orientation Estimate’);
legend(‘Z-rotation’, ‘Y-rotation’, ‘X-rotation’);
ylabel(‘Degrees’);
% ————— QUA C’E’ LA PARTE PER IL FILTRO ———————–
imuFs_nonHolonomic = 100;
imuFs_imuFilter = 100;
gpsFs = 1;
imuSamplesPerGPS = imuFs_nonHolonomic/gpsFs;
localOrigin = [latitudine(1) longitudine(1) altitudine(1)];
% ——————- DEFINIZIONE NONHOLONOMIC FILTER ———————
filt = insfilterNonholonomic(‘ReferenceFrame’, ‘NED’);
filt.IMUSampleRate = imuFs_nonHolonomic;
filt.ReferenceLocation = localOrigin;
filt.StateCovariance = 1e-6*eye(16);
% parametri del filtro: noise acc e gyro
filt.AccelerometerNoise = 3.8416e-04;
filt.GyroscopeNoise = 0.0597;
Rpos = 0.001 * eye(3);
% ——- LOOP PRINCIPALE PER IL FILTRO ——————-
numIMUSamples = length(tempo_desiderato);
estOrient = quaternion.ones(numIMUSamples,1);
estPos = zeros(numIMUSamples,3);
estVel = zeros(numIMUSamples,3);
gpsIdx = 1;
correzioni = [];
factor_div = round(numIMUSamples/length_gps);
for idx = 1:numIMUSamples
predict(filt, acc_tot(idx,:), gyro_tot(idx,:)); %Predict filter state
tcorrente = tempo_desiderato(idx);
if tempi_gps(gpsIdx+1)<=tcorrente
% if (mod(idx, factor_div) == 0) %Correct filter state….. fai il fuseGPS ogni 1000 campioni (se simulo su 2 minuti)…
%gpsLLA(gpsIdx,:) = [latitudine(gpsIdx,:) longitudine(gpsIdx,:) altitudine(gpsIdx,:)];
%interp1 per gps su tempocorr
prima = pose(filt);
% fusegps(filt, [lat_interp(gpsIdx,:) lon_interp(gpsIdx,:) altitudine(gpsIdx,:)], Rpos);
fusegps(filt, [latitudine(gpsIdx,:) longitudine(gpsIdx,:) altitudine(gpsIdx,:)], Rpos);
dopo = pose(filt);
correzioni = [correzioni; prima, dopo]; %memorizza correzioni GPS
%[estPos(gpsIdx,:), estOrient(gpsIdx,:), estVel(gpsIdx,:)] = pose(filt); %Log estimated pose
gpsIdx = gpsIdx + 1;
end
[estPos(idx,:), estOrient(idx,:), estVel(gpsIdx,:)] = pose(filt);
end
% plot del risultato
plot(xEast,yNorth,’k’);
xlabel(‘x [m]’);
ylabel(‘y [m]’);
hold on
plot(estPos(:,2), estPos(:,1), ‘g’);
The final plot result should be different from what I get, can anyone tell me why?
I can also share the csv files if needed.
Thank you very much,
alberto.good morning, everyone.
i am working on a project to reconstruct a route using data from two sensors: gps and imu. I am working with two arduino boards, on one is integrated the imu while the gps is connected to the other board.
The sensor data is saved to two csv files which I then use in matlab.
The matlab code I have developed is as follows: I load the data from the gps and the imu and implement an extended kalman filter with the nonholonomic filter.
clear;
% carico dati del GPS
data_gps = load(‘C:UsersalberOneDriveDesktopTESIPROVE_CAMPUS14-01 (casa)output_gga.csv’);
% LATITUDINE, LONGITUDINE E ALTITUDINE
latitudine = data_gps(:,1);
longitudine = data_gps(:,2);
altitudine = data_gps(:,3);
time_gps = data_gps(:,4);
origine = [latitudine(1) longitudine(1) altitudine(1)];
%converti in coordinate locali
[xEast, yNorth, zUp] = latlon2local(latitudine, longitudine, altitudine, origine);
% converto il tempo del gps in secondi
tempi_gps_csv = num2str(time_gps);
ore = str2num(tempi_gps_csv(:,1:2));
minuti = str2num(tempi_gps_csv(:,3:4));
secondi = str2num(tempi_gps_csv(:,5:6));
tempi_secondi = ore*3600 + minuti*60 + secondi;
tempo_inizio = tempi_secondi(1);
tempi_gps = tempi_secondi – tempo_inizio;
% carico dati della IMU
data_imu = load(‘C:UsersalberOneDriveDesktopTESIPROVE_CAMPUS14-01 (casa)IMU.csv’);
N = length(data_imu);
accx_origin = data_imu(1:N,1);
accy_origin = data_imu(1:N,2);
accz_origin = data_imu(1:N,3);
acc_tot_origin = [accx_origin accy_origin accz_origin];
gyrox_origin = data_imu(1:N,4);
gyroy_origin = data_imu(1:N,5);
gyroz_origin = data_imu(1:N,6);
gyro_tot_origin = [gyrox_origin gyroy_origin gyroz_origin];
time_imu = data_imu(1:N,7);
% CONVERTO I DATI DI ACCELEROMETRO E GIROSCOPIO
% converto ‘deg/s’ to ‘rad/s’
gyro_tot_rad = convangvel(gyro_tot_origin, ‘deg/s’, ‘rad/s’);
% converto ‘g’ in ‘m/s^2’
acc_tot_meter = convacc(acc_tot_origin, ‘G”s’, ‘m/s^2’);
%converto il tempo della imu in secondi
tempi_imu_csv = num2str(floor(time_imu));
ore = str2num(tempi_imu_csv(:,1:2));
minuti = str2num(tempi_imu_csv(:,3:4));
secondi = str2num(tempi_imu_csv(:,5:6));
tempi_imu = ore*3600 + minuti*60 + secondi + mod(time_imu,1);
tempi_imu = tempi_imu – tempo_inizio;
% vettore tempi per l’operazione di interpolazione
tempo_desiderato = (tempi_imu(1):0.01:tempi_imu(end))’;
% ——— INTERPOLAZIONE ———–
accx = interp1(tempi_imu, acc_tot_meter(:,1), tempo_desiderato); %la time_imu sarebbe il ‘utc.delta_millis’ che calcolo
accy = interp1(tempi_imu, acc_tot_meter(:,2), tempo_desiderato);
accz = interp1(tempi_imu, acc_tot_meter(:,3), tempo_desiderato);
acc_tot = [accx accy accz];
% gyrox = interp1(time_imu, gyrox_origin, tempo_desiderato);
% gyroy = interp1(time_imu, gyroy_origin, tempo_desiderato);
% gyroz = interp1(time_imu, gyroz_origin, tempo_desiderato);
gyrox = interp1(tempi_imu, gyro_tot_rad(:,1), tempo_desiderato);
gyroy = interp1(tempi_imu, gyro_tot_rad(:,2), tempo_desiderato);
gyroz = interp1(tempi_imu, gyro_tot_rad(:,3), tempo_desiderato);
gyro_tot = [gyrox gyroy gyroz];
% vado ad interpolare anche le coord del gps
lat_interp = interp1(tempi_gps, latitudine, tempo_desiderato);
lon_interp = interp1(tempi_gps, longitudine, tempo_desiderato);
alt_interp = interp1(tempi_gps, altitudine, tempo_desiderato);
length_imu = length(acc_tot); %numero di elementi sul file csv
length_gps = length(data_gps);
% —————— IMU FILTER ———————–
fuse = imufilter(‘ReferenceFrame’, ‘NED’,’SampleRate’, 100,’GyroscopeNoise’, 0.0597, ‘AccelerometerNoise’, 3.8416e-04);
[orientazione ,angVelBodyRecovered] = fuse(acc_tot, gyro_tot);
% Plot Euler angles in degrees
A = eulerd(orientazione, ‘ZYX’, ‘frame’);
plot(eulerd(orientazione, ‘ZYX’, ‘frame’));
title(‘Orientation Estimate’);
legend(‘Z-rotation’, ‘Y-rotation’, ‘X-rotation’);
ylabel(‘Degrees’);
% ————— QUA C’E’ LA PARTE PER IL FILTRO ———————–
imuFs_nonHolonomic = 100;
imuFs_imuFilter = 100;
gpsFs = 1;
imuSamplesPerGPS = imuFs_nonHolonomic/gpsFs;
localOrigin = [latitudine(1) longitudine(1) altitudine(1)];
% ——————- DEFINIZIONE NONHOLONOMIC FILTER ———————
filt = insfilterNonholonomic(‘ReferenceFrame’, ‘NED’);
filt.IMUSampleRate = imuFs_nonHolonomic;
filt.ReferenceLocation = localOrigin;
filt.StateCovariance = 1e-6*eye(16);
% parametri del filtro: noise acc e gyro
filt.AccelerometerNoise = 3.8416e-04;
filt.GyroscopeNoise = 0.0597;
Rpos = 0.001 * eye(3);
% ——- LOOP PRINCIPALE PER IL FILTRO ——————-
numIMUSamples = length(tempo_desiderato);
estOrient = quaternion.ones(numIMUSamples,1);
estPos = zeros(numIMUSamples,3);
estVel = zeros(numIMUSamples,3);
gpsIdx = 1;
correzioni = [];
factor_div = round(numIMUSamples/length_gps);
for idx = 1:numIMUSamples
predict(filt, acc_tot(idx,:), gyro_tot(idx,:)); %Predict filter state
tcorrente = tempo_desiderato(idx);
if tempi_gps(gpsIdx+1)<=tcorrente
% if (mod(idx, factor_div) == 0) %Correct filter state….. fai il fuseGPS ogni 1000 campioni (se simulo su 2 minuti)…
%gpsLLA(gpsIdx,:) = [latitudine(gpsIdx,:) longitudine(gpsIdx,:) altitudine(gpsIdx,:)];
%interp1 per gps su tempocorr
prima = pose(filt);
% fusegps(filt, [lat_interp(gpsIdx,:) lon_interp(gpsIdx,:) altitudine(gpsIdx,:)], Rpos);
fusegps(filt, [latitudine(gpsIdx,:) longitudine(gpsIdx,:) altitudine(gpsIdx,:)], Rpos);
dopo = pose(filt);
correzioni = [correzioni; prima, dopo]; %memorizza correzioni GPS
%[estPos(gpsIdx,:), estOrient(gpsIdx,:), estVel(gpsIdx,:)] = pose(filt); %Log estimated pose
gpsIdx = gpsIdx + 1;
end
[estPos(idx,:), estOrient(idx,:), estVel(gpsIdx,:)] = pose(filt);
end
% plot del risultato
plot(xEast,yNorth,’k’);
xlabel(‘x [m]’);
ylabel(‘y [m]’);
hold on
plot(estPos(:,2), estPos(:,1), ‘g’);
The final plot result should be different from what I get, can anyone tell me why?
I can also share the csv files if needed.
Thank you very much,
alberto. good morning, everyone.
i am working on a project to reconstruct a route using data from two sensors: gps and imu. I am working with two arduino boards, on one is integrated the imu while the gps is connected to the other board.
The sensor data is saved to two csv files which I then use in matlab.
The matlab code I have developed is as follows: I load the data from the gps and the imu and implement an extended kalman filter with the nonholonomic filter.
clear;
% carico dati del GPS
data_gps = load(‘C:UsersalberOneDriveDesktopTESIPROVE_CAMPUS14-01 (casa)output_gga.csv’);
% LATITUDINE, LONGITUDINE E ALTITUDINE
latitudine = data_gps(:,1);
longitudine = data_gps(:,2);
altitudine = data_gps(:,3);
time_gps = data_gps(:,4);
origine = [latitudine(1) longitudine(1) altitudine(1)];
%converti in coordinate locali
[xEast, yNorth, zUp] = latlon2local(latitudine, longitudine, altitudine, origine);
% converto il tempo del gps in secondi
tempi_gps_csv = num2str(time_gps);
ore = str2num(tempi_gps_csv(:,1:2));
minuti = str2num(tempi_gps_csv(:,3:4));
secondi = str2num(tempi_gps_csv(:,5:6));
tempi_secondi = ore*3600 + minuti*60 + secondi;
tempo_inizio = tempi_secondi(1);
tempi_gps = tempi_secondi – tempo_inizio;
% carico dati della IMU
data_imu = load(‘C:UsersalberOneDriveDesktopTESIPROVE_CAMPUS14-01 (casa)IMU.csv’);
N = length(data_imu);
accx_origin = data_imu(1:N,1);
accy_origin = data_imu(1:N,2);
accz_origin = data_imu(1:N,3);
acc_tot_origin = [accx_origin accy_origin accz_origin];
gyrox_origin = data_imu(1:N,4);
gyroy_origin = data_imu(1:N,5);
gyroz_origin = data_imu(1:N,6);
gyro_tot_origin = [gyrox_origin gyroy_origin gyroz_origin];
time_imu = data_imu(1:N,7);
% CONVERTO I DATI DI ACCELEROMETRO E GIROSCOPIO
% converto ‘deg/s’ to ‘rad/s’
gyro_tot_rad = convangvel(gyro_tot_origin, ‘deg/s’, ‘rad/s’);
% converto ‘g’ in ‘m/s^2’
acc_tot_meter = convacc(acc_tot_origin, ‘G”s’, ‘m/s^2’);
%converto il tempo della imu in secondi
tempi_imu_csv = num2str(floor(time_imu));
ore = str2num(tempi_imu_csv(:,1:2));
minuti = str2num(tempi_imu_csv(:,3:4));
secondi = str2num(tempi_imu_csv(:,5:6));
tempi_imu = ore*3600 + minuti*60 + secondi + mod(time_imu,1);
tempi_imu = tempi_imu – tempo_inizio;
% vettore tempi per l’operazione di interpolazione
tempo_desiderato = (tempi_imu(1):0.01:tempi_imu(end))’;
% ——— INTERPOLAZIONE ———–
accx = interp1(tempi_imu, acc_tot_meter(:,1), tempo_desiderato); %la time_imu sarebbe il ‘utc.delta_millis’ che calcolo
accy = interp1(tempi_imu, acc_tot_meter(:,2), tempo_desiderato);
accz = interp1(tempi_imu, acc_tot_meter(:,3), tempo_desiderato);
acc_tot = [accx accy accz];
% gyrox = interp1(time_imu, gyrox_origin, tempo_desiderato);
% gyroy = interp1(time_imu, gyroy_origin, tempo_desiderato);
% gyroz = interp1(time_imu, gyroz_origin, tempo_desiderato);
gyrox = interp1(tempi_imu, gyro_tot_rad(:,1), tempo_desiderato);
gyroy = interp1(tempi_imu, gyro_tot_rad(:,2), tempo_desiderato);
gyroz = interp1(tempi_imu, gyro_tot_rad(:,3), tempo_desiderato);
gyro_tot = [gyrox gyroy gyroz];
% vado ad interpolare anche le coord del gps
lat_interp = interp1(tempi_gps, latitudine, tempo_desiderato);
lon_interp = interp1(tempi_gps, longitudine, tempo_desiderato);
alt_interp = interp1(tempi_gps, altitudine, tempo_desiderato);
length_imu = length(acc_tot); %numero di elementi sul file csv
length_gps = length(data_gps);
% —————— IMU FILTER ———————–
fuse = imufilter(‘ReferenceFrame’, ‘NED’,’SampleRate’, 100,’GyroscopeNoise’, 0.0597, ‘AccelerometerNoise’, 3.8416e-04);
[orientazione ,angVelBodyRecovered] = fuse(acc_tot, gyro_tot);
% Plot Euler angles in degrees
A = eulerd(orientazione, ‘ZYX’, ‘frame’);
plot(eulerd(orientazione, ‘ZYX’, ‘frame’));
title(‘Orientation Estimate’);
legend(‘Z-rotation’, ‘Y-rotation’, ‘X-rotation’);
ylabel(‘Degrees’);
% ————— QUA C’E’ LA PARTE PER IL FILTRO ———————–
imuFs_nonHolonomic = 100;
imuFs_imuFilter = 100;
gpsFs = 1;
imuSamplesPerGPS = imuFs_nonHolonomic/gpsFs;
localOrigin = [latitudine(1) longitudine(1) altitudine(1)];
% ——————- DEFINIZIONE NONHOLONOMIC FILTER ———————
filt = insfilterNonholonomic(‘ReferenceFrame’, ‘NED’);
filt.IMUSampleRate = imuFs_nonHolonomic;
filt.ReferenceLocation = localOrigin;
filt.StateCovariance = 1e-6*eye(16);
% parametri del filtro: noise acc e gyro
filt.AccelerometerNoise = 3.8416e-04;
filt.GyroscopeNoise = 0.0597;
Rpos = 0.001 * eye(3);
% ——- LOOP PRINCIPALE PER IL FILTRO ——————-
numIMUSamples = length(tempo_desiderato);
estOrient = quaternion.ones(numIMUSamples,1);
estPos = zeros(numIMUSamples,3);
estVel = zeros(numIMUSamples,3);
gpsIdx = 1;
correzioni = [];
factor_div = round(numIMUSamples/length_gps);
for idx = 1:numIMUSamples
predict(filt, acc_tot(idx,:), gyro_tot(idx,:)); %Predict filter state
tcorrente = tempo_desiderato(idx);
if tempi_gps(gpsIdx+1)<=tcorrente
% if (mod(idx, factor_div) == 0) %Correct filter state….. fai il fuseGPS ogni 1000 campioni (se simulo su 2 minuti)…
%gpsLLA(gpsIdx,:) = [latitudine(gpsIdx,:) longitudine(gpsIdx,:) altitudine(gpsIdx,:)];
%interp1 per gps su tempocorr
prima = pose(filt);
% fusegps(filt, [lat_interp(gpsIdx,:) lon_interp(gpsIdx,:) altitudine(gpsIdx,:)], Rpos);
fusegps(filt, [latitudine(gpsIdx,:) longitudine(gpsIdx,:) altitudine(gpsIdx,:)], Rpos);
dopo = pose(filt);
correzioni = [correzioni; prima, dopo]; %memorizza correzioni GPS
%[estPos(gpsIdx,:), estOrient(gpsIdx,:), estVel(gpsIdx,:)] = pose(filt); %Log estimated pose
gpsIdx = gpsIdx + 1;
end
[estPos(idx,:), estOrient(idx,:), estVel(gpsIdx,:)] = pose(filt);
end
% plot del risultato
plot(xEast,yNorth,’k’);
xlabel(‘x [m]’);
ylabel(‘y [m]’);
hold on
plot(estPos(:,2), estPos(:,1), ‘g’);
The final plot result should be different from what I get, can anyone tell me why?
I can also share the csv files if needed.
Thank you very much,
alberto. nonholonomic filter, gps, fusion data, extended kalman filter, position estimation MATLAB Answers — New Questions