Tag Archives: matlab
Extracting neighbouring cells in a cell array
This is a follow up to this question. I have cell array and a list of cells of interests (given as a matrix, whose columns correspond to the indices of cells). I want to access and concatenate the entries of all cells located +/- 1 the cell of interest.
For example, as suggested in the accepted answer to the references question, I construct the cell array A as follows
B = [1,2,2,1,1; 2,1,2,1,2];
V = 1:size(B,2);
A = accumarray(B.’,V(:),[],@(m){m.’})
Now I have the matrix C with the cells of interest
C=[1 2; 1 2]
I have 2 neighbourhoods that I want to explore
NbhInd1=[1 1 2; 1 2 1];
NbhInd2=[1 2 2; 2 2 1];
In the end, I want to be able to get two arrays of neighbourhoods (can be sorted or unsorted)
Nbh1=[4 1 5 2]
Nbh2=[1 5 3 2]
I have 3 problems:
(Same as in the referenced question): I don’t know how to convert an array into a proper index to refer to the correct cell of A. I.e. A{[1,1]} or A ([1,1]) is not the same as A{1,1}, and I need to the latter.
How to automate the construction of indices of the neighbourhoods. In principle, I can use combinations() but it gives too many indices. Also, I’m not sure how to automatically easily convert [1,1] into table2array(combinations(1:2,1:2)), i.e. splitting an array into its coordinates and manipulating separately
The true array A has high dimensionality (e.g. size(A)=repmat(9,[1,10])), so I’d like to minimize the number of loops.This is a follow up to this question. I have cell array and a list of cells of interests (given as a matrix, whose columns correspond to the indices of cells). I want to access and concatenate the entries of all cells located +/- 1 the cell of interest.
For example, as suggested in the accepted answer to the references question, I construct the cell array A as follows
B = [1,2,2,1,1; 2,1,2,1,2];
V = 1:size(B,2);
A = accumarray(B.’,V(:),[],@(m){m.’})
Now I have the matrix C with the cells of interest
C=[1 2; 1 2]
I have 2 neighbourhoods that I want to explore
NbhInd1=[1 1 2; 1 2 1];
NbhInd2=[1 2 2; 2 2 1];
In the end, I want to be able to get two arrays of neighbourhoods (can be sorted or unsorted)
Nbh1=[4 1 5 2]
Nbh2=[1 5 3 2]
I have 3 problems:
(Same as in the referenced question): I don’t know how to convert an array into a proper index to refer to the correct cell of A. I.e. A{[1,1]} or A ([1,1]) is not the same as A{1,1}, and I need to the latter.
How to automate the construction of indices of the neighbourhoods. In principle, I can use combinations() but it gives too many indices. Also, I’m not sure how to automatically easily convert [1,1] into table2array(combinations(1:2,1:2)), i.e. splitting an array into its coordinates and manipulating separately
The true array A has high dimensionality (e.g. size(A)=repmat(9,[1,10])), so I’d like to minimize the number of loops. This is a follow up to this question. I have cell array and a list of cells of interests (given as a matrix, whose columns correspond to the indices of cells). I want to access and concatenate the entries of all cells located +/- 1 the cell of interest.
For example, as suggested in the accepted answer to the references question, I construct the cell array A as follows
B = [1,2,2,1,1; 2,1,2,1,2];
V = 1:size(B,2);
A = accumarray(B.’,V(:),[],@(m){m.’})
Now I have the matrix C with the cells of interest
C=[1 2; 1 2]
I have 2 neighbourhoods that I want to explore
NbhInd1=[1 1 2; 1 2 1];
NbhInd2=[1 2 2; 2 2 1];
In the end, I want to be able to get two arrays of neighbourhoods (can be sorted or unsorted)
Nbh1=[4 1 5 2]
Nbh2=[1 5 3 2]
I have 3 problems:
(Same as in the referenced question): I don’t know how to convert an array into a proper index to refer to the correct cell of A. I.e. A{[1,1]} or A ([1,1]) is not the same as A{1,1}, and I need to the latter.
How to automate the construction of indices of the neighbourhoods. In principle, I can use combinations() but it gives too many indices. Also, I’m not sure how to automatically easily convert [1,1] into table2array(combinations(1:2,1:2)), i.e. splitting an array into its coordinates and manipulating separately
The true array A has high dimensionality (e.g. size(A)=repmat(9,[1,10])), so I’d like to minimize the number of loops. cell array, array, index MATLAB Answers — New Questions
Error while running MATLAB example model “QPSK Receiver with ADALM-PLUTO Radio in Simulink”
I am trying to run the MATLAB example model "QPSK Receiver with ADALM-PLUTO Radio in Simulink" from the link https://www.mathworks.com/help/comm/plutoradio/ug/qpsk-receiver-with-adalm-pluto-radio-1.html, When I run this model without making any changes, it is giving error in frame synchronizer as shown in the figure attached.I am trying to run the MATLAB example model "QPSK Receiver with ADALM-PLUTO Radio in Simulink" from the link https://www.mathworks.com/help/comm/plutoradio/ug/qpsk-receiver-with-adalm-pluto-radio-1.html, When I run this model without making any changes, it is giving error in frame synchronizer as shown in the figure attached. I am trying to run the MATLAB example model "QPSK Receiver with ADALM-PLUTO Radio in Simulink" from the link https://www.mathworks.com/help/comm/plutoradio/ug/qpsk-receiver-with-adalm-pluto-radio-1.html, When I run this model without making any changes, it is giving error in frame synchronizer as shown in the figure attached. qpsk receiver, pluto sdr MATLAB Answers — New Questions
Non uniform sample in frequency analysis! non uniform dft?
Hallo! I am working in project that I have to make a frequency analysis on a time series. However my sample is not uniformly sampled so the Fast Fourier Transformation(FFT) is not appropriate for my analysis. After a search I found that for my case( no uniform sample) there is the Non Uniform Discrete Fourier Transformation (nuDFT). Does anyone know where can I find such a code or can suggest me any other way to make it?Hallo! I am working in project that I have to make a frequency analysis on a time series. However my sample is not uniformly sampled so the Fast Fourier Transformation(FFT) is not appropriate for my analysis. After a search I found that for my case( no uniform sample) there is the Non Uniform Discrete Fourier Transformation (nuDFT). Does anyone know where can I find such a code or can suggest me any other way to make it? Hallo! I am working in project that I have to make a frequency analysis on a time series. However my sample is not uniformly sampled so the Fast Fourier Transformation(FFT) is not appropriate for my analysis. After a search I found that for my case( no uniform sample) there is the Non Uniform Discrete Fourier Transformation (nuDFT). Does anyone know where can I find such a code or can suggest me any other way to make it? non uniform discrete fast sample fourier frequency analysis MATLAB Answers — New Questions
need to shrink the polygon
I am workin on a project in c# of modeling building for greenBuilding.
for the simulation, I need to put the vertices for the outside of the flat external wall, the the centeral of the wall between flats.
For this, I am doing great and I also calculated the area.
But I also need the NET floor area by reducing the walls thickness.
Not all the wall have the same thickness but I do know this
the Gross area
the thickness of each wall
the length of each wall
How can I substract the walls from the Gross to get the NET floor area
in the example i loaded,
I have the vertices of the pink polygon and use a formuka to find the area of 1400 and than I moved two line by 5 and the rest by 4.
How do I find the net areaI am workin on a project in c# of modeling building for greenBuilding.
for the simulation, I need to put the vertices for the outside of the flat external wall, the the centeral of the wall between flats.
For this, I am doing great and I also calculated the area.
But I also need the NET floor area by reducing the walls thickness.
Not all the wall have the same thickness but I do know this
the Gross area
the thickness of each wall
the length of each wall
How can I substract the walls from the Gross to get the NET floor area
in the example i loaded,
I have the vertices of the pink polygon and use a formuka to find the area of 1400 and than I moved two line by 5 and the rest by 4.
How do I find the net area I am workin on a project in c# of modeling building for greenBuilding.
for the simulation, I need to put the vertices for the outside of the flat external wall, the the centeral of the wall between flats.
For this, I am doing great and I also calculated the area.
But I also need the NET floor area by reducing the walls thickness.
Not all the wall have the same thickness but I do know this
the Gross area
the thickness of each wall
the length of each wall
How can I substract the walls from the Gross to get the NET floor area
in the example i loaded,
I have the vertices of the pink polygon and use a formuka to find the area of 1400 and than I moved two line by 5 and the rest by 4.
How do I find the net area polygon area, vertices MATLAB Answers — New Questions
Design of Strong Prescribed Time (SPT) Controller for Manipulator (Example 2)
I’m working on implementing a Strong Prescribed Time (SPT) controller for a manipulator in MATLAB. I’ve successfully designed the controller for the first example provided in a research paper. However, I’m facing challenges with the second example. Designing the SPT controller for the second example’s manipulator dynamics.
The paper (Ding et al., 2023) outlines the SPT controller design procedure and manipulator dynamics.
type Exmp2.mI’m working on implementing a Strong Prescribed Time (SPT) controller for a manipulator in MATLAB. I’ve successfully designed the controller for the first example provided in a research paper. However, I’m facing challenges with the second example. Designing the SPT controller for the second example’s manipulator dynamics.
The paper (Ding et al., 2023) outlines the SPT controller design procedure and manipulator dynamics.
type Exmp2.m I’m working on implementing a Strong Prescribed Time (SPT) controller for a manipulator in MATLAB. I’ve successfully designed the controller for the first example provided in a research paper. However, I’m facing challenges with the second example. Designing the SPT controller for the second example’s manipulator dynamics.
The paper (Ding et al., 2023) outlines the SPT controller design procedure and manipulator dynamics.
type Exmp2.m control MATLAB Answers — New Questions
Accessing cell array entries using arrays
I have a multi-dimensional cell array and matrix, whose columns correspons to indices of the cell array. I want to populate the cells with arrays that correspond to the indices of the columns that refer to the given cell.
Minimal example:
A=cell(2,2);
B=[1 2 2 1 1; 2 1 2 1 2]
A{1,1}=[4];
A{1,2}=[1,5];
A{2,1}=[2];
A{2,2}=[3]
I’m trying to do this automatically by looping over the columns of the matrix B, but I can’t figure out how to extract the entries of the array without keeping the array form. Calling neither
A(B(:,1))
nor
A{B(:,1)}
produces the correct entry
A{1,2}I have a multi-dimensional cell array and matrix, whose columns correspons to indices of the cell array. I want to populate the cells with arrays that correspond to the indices of the columns that refer to the given cell.
Minimal example:
A=cell(2,2);
B=[1 2 2 1 1; 2 1 2 1 2]
A{1,1}=[4];
A{1,2}=[1,5];
A{2,1}=[2];
A{2,2}=[3]
I’m trying to do this automatically by looping over the columns of the matrix B, but I can’t figure out how to extract the entries of the array without keeping the array form. Calling neither
A(B(:,1))
nor
A{B(:,1)}
produces the correct entry
A{1,2} I have a multi-dimensional cell array and matrix, whose columns correspons to indices of the cell array. I want to populate the cells with arrays that correspond to the indices of the columns that refer to the given cell.
Minimal example:
A=cell(2,2);
B=[1 2 2 1 1; 2 1 2 1 2]
A{1,1}=[4];
A{1,2}=[1,5];
A{2,1}=[2];
A{2,2}=[3]
I’m trying to do this automatically by looping over the columns of the matrix B, but I can’t figure out how to extract the entries of the array without keeping the array form. Calling neither
A(B(:,1))
nor
A{B(:,1)}
produces the correct entry
A{1,2} cell array, index, array MATLAB Answers — New Questions
Getting Error of mclmcrrt.dll while opening the MPLOT in EMTP
I am currently working on the EMTP software and after simulation while i start MPLOT it showing me an error,
I tried installing the 9.3 version but still getting the same error. Please Let me know if anyone got the solution.I am currently working on the EMTP software and after simulation while i start MPLOT it showing me an error,
I tried installing the 9.3 version but still getting the same error. Please Let me know if anyone got the solution. I am currently working on the EMTP software and after simulation while i start MPLOT it showing me an error,
I tried installing the 9.3 version but still getting the same error. Please Let me know if anyone got the solution. dll, emtp, mplot, error MATLAB Answers — New Questions
Matlab python package. ModuleNotFoundError: No module named ‘wheel’
Hi installing python packaged matlab function results in this error when running to create a wheel starting of pip version 24.
This works fine for pip 23, can anyone help solve this?
pip wheel –no-cache-dir –use-pep517 "wwd-celloutput-r2023a @ file:///home/sander/dev/calculators/model/matlab/WWD_calculator_package"
× Building wheel for wwd-celloutput-r2023a (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [18 lines of output]
bdist_wheel requires the ‘wheel’ module, which can be installed via pip.
Traceback (most recent call last):
File "/home/sander/.cache/pypoetry/virtualenvs/calculators-4b8SRMwI-py3.10/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
main()
File "/home/sander/.cache/pypoetry/virtualenvs/calculators-4b8SRMwI-py3.10/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
json_out[‘return_val’] = hook(**hook_input[‘kwargs’])
File "/home/sander/.cache/pypoetry/virtualenvs/calculators-4b8SRMwI-py3.10/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 251, in build_wheel
return _build_backend().build_wheel(wheel_directory, config_settings,
File "/tmp/pip-build-env-540icr8g/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 415, in build_wheel
return self._build_with_temp_dir(
File "/tmp/pip-build-env-540icr8g/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 397, in _build_with_temp_dir
self.run_setup()
File "/tmp/pip-build-env-540icr8g/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 497, in run_setup
super().run_setup(setup_script=setup_script)
File "/tmp/pip-build-env-540icr8g/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 313, in run_setup
exec(code, locals())
File "<string>", line 23, in <module>
ModuleNotFoundError: No module named ‘wheel’
[end of output]Hi installing python packaged matlab function results in this error when running to create a wheel starting of pip version 24.
This works fine for pip 23, can anyone help solve this?
pip wheel –no-cache-dir –use-pep517 "wwd-celloutput-r2023a @ file:///home/sander/dev/calculators/model/matlab/WWD_calculator_package"
× Building wheel for wwd-celloutput-r2023a (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [18 lines of output]
bdist_wheel requires the ‘wheel’ module, which can be installed via pip.
Traceback (most recent call last):
File "/home/sander/.cache/pypoetry/virtualenvs/calculators-4b8SRMwI-py3.10/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
main()
File "/home/sander/.cache/pypoetry/virtualenvs/calculators-4b8SRMwI-py3.10/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
json_out[‘return_val’] = hook(**hook_input[‘kwargs’])
File "/home/sander/.cache/pypoetry/virtualenvs/calculators-4b8SRMwI-py3.10/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 251, in build_wheel
return _build_backend().build_wheel(wheel_directory, config_settings,
File "/tmp/pip-build-env-540icr8g/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 415, in build_wheel
return self._build_with_temp_dir(
File "/tmp/pip-build-env-540icr8g/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 397, in _build_with_temp_dir
self.run_setup()
File "/tmp/pip-build-env-540icr8g/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 497, in run_setup
super().run_setup(setup_script=setup_script)
File "/tmp/pip-build-env-540icr8g/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 313, in run_setup
exec(code, locals())
File "<string>", line 23, in <module>
ModuleNotFoundError: No module named ‘wheel’
[end of output] Hi installing python packaged matlab function results in this error when running to create a wheel starting of pip version 24.
This works fine for pip 23, can anyone help solve this?
pip wheel –no-cache-dir –use-pep517 "wwd-celloutput-r2023a @ file:///home/sander/dev/calculators/model/matlab/WWD_calculator_package"
× Building wheel for wwd-celloutput-r2023a (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [18 lines of output]
bdist_wheel requires the ‘wheel’ module, which can be installed via pip.
Traceback (most recent call last):
File "/home/sander/.cache/pypoetry/virtualenvs/calculators-4b8SRMwI-py3.10/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
main()
File "/home/sander/.cache/pypoetry/virtualenvs/calculators-4b8SRMwI-py3.10/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
json_out[‘return_val’] = hook(**hook_input[‘kwargs’])
File "/home/sander/.cache/pypoetry/virtualenvs/calculators-4b8SRMwI-py3.10/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 251, in build_wheel
return _build_backend().build_wheel(wheel_directory, config_settings,
File "/tmp/pip-build-env-540icr8g/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 415, in build_wheel
return self._build_with_temp_dir(
File "/tmp/pip-build-env-540icr8g/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 397, in _build_with_temp_dir
self.run_setup()
File "/tmp/pip-build-env-540icr8g/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 497, in run_setup
super().run_setup(setup_script=setup_script)
File "/tmp/pip-build-env-540icr8g/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 313, in run_setup
exec(code, locals())
File "<string>", line 23, in <module>
ModuleNotFoundError: No module named ‘wheel’
[end of output] python, package, pip MATLAB Answers — New Questions
How to speed up this code?
Dear All,
I have this code but when I run it it takes one day and half to run. How can I speed it up?
Best regards,
Ara
clear all;
clc;
% Set the folder path where the .nc files are located
folderPath = ‘E:datapodtc_apr’;
% Get a list of all NetCDF files in the folder
fileList = dir(fullfile(folderPath, ‘*_nc’));
numFiles = numel(fileList);
% Initialize the data structures
data = cell(numFiles, 1);
dateArray = [];
typeArray = cell(numFiles, 1);
% Loop through each file
for fileIndex = 1:numFiles
% Read the NetCDF file
filePath = fullfile(folderPath, fileList(fileIndex).name);
% Read the data from the NetCDF file
ncinfo_struct = ncinfo(filePath);
if isfield(ncinfo_struct, ‘Variables’)
variable_names = {ncinfo_struct.Variables.Name};
if all(ismember({‘time’, ‘TEC’, ‘S4’, ‘RFI’, ‘elevation’, ‘occheight’, ‘caL1_SNR’, ‘pL2_SNR’, ‘x_LEO’, ‘y_LEO’, ‘z_LEO’, ‘x_GPS’, ‘y_GPS’, ‘z_GPS’}, variable_names))
% Extract the date and type information from the file name
[~, filename, ~] = fileparts(fileList(fileIndex).name);
dateStr = regexp(filename, ‘d{4}.d{3}’, ‘match’, ‘once’);
typeStr = regexp(filename, ‘Gd{2}|Rd{2}’, ‘match’, ‘once’);
% Read the data from the NetCDF file
data{fileIndex}.time = ncread(filePath, ‘time’);
data{fileIndex}.TEC = ncread(filePath, ‘TEC’);
data{fileIndex}.S4 = ncread(filePath, ‘S4’);
data{fileIndex}.RFI = ncread(filePath, ‘RFI’);
data{fileIndex}.elevation = ncread(filePath, ‘elevation’);
data{fileIndex}.occheight = ncread(filePath, ‘occheight’);
data{fileIndex}.caL1_SNR = ncread(filePath, ‘caL1_SNR’);
data{fileIndex}.pL2_SNR = ncread(filePath, ‘pL2_SNR’);
data{fileIndex}.x_LEO = ncread(filePath, ‘x_LEO’);
data{fileIndex}.y_LEO = ncread(filePath, ‘y_LEO’);
data{fileIndex}.z_LEO = ncread(filePath, ‘z_LEO’);
data{fileIndex}.x_GPS = ncread(filePath, ‘x_GPS’);
data{fileIndex}.y_GPS = ncread(filePath, ‘y_GPS’);
data{fileIndex}.z_GPS = ncread(filePath, ‘z_GPS’);
% Store the date and type information
dateArray = [dateArray, str2double(dateStr)];
typeArray{fileIndex} = typeStr;
else
% Skip this file and move on to the next one
fprintf(‘File "%s" does not contain all the required variables. Skipping this file.n’, fileList(fileIndex).name);
continue;
end
else
% Skip this file and move on to the next one
fprintf(‘File "%s" does not contain the "Variables" field. Skipping this file.n’, fileList(fileIndex).name);
continue;
end
end
% Sort the data by date and type
[sortedDates, sortedIndices] = sort(dateArray);
sortedTypes = cellfun(@(x) x, typeArray(sortedIndices), ‘UniformOutput’, false);
% Create the sorted data structures
sortedData = cell(numFiles, 1);
for i = 1:numFiles
sortedData{i} = data{sortedIndices(i)};
end
% Save the data to a .mat file
save(‘podtc_apr_data.mat’, ‘sortedData’, ‘sortedDates’, ‘sortedTypes’);Dear All,
I have this code but when I run it it takes one day and half to run. How can I speed it up?
Best regards,
Ara
clear all;
clc;
% Set the folder path where the .nc files are located
folderPath = ‘E:datapodtc_apr’;
% Get a list of all NetCDF files in the folder
fileList = dir(fullfile(folderPath, ‘*_nc’));
numFiles = numel(fileList);
% Initialize the data structures
data = cell(numFiles, 1);
dateArray = [];
typeArray = cell(numFiles, 1);
% Loop through each file
for fileIndex = 1:numFiles
% Read the NetCDF file
filePath = fullfile(folderPath, fileList(fileIndex).name);
% Read the data from the NetCDF file
ncinfo_struct = ncinfo(filePath);
if isfield(ncinfo_struct, ‘Variables’)
variable_names = {ncinfo_struct.Variables.Name};
if all(ismember({‘time’, ‘TEC’, ‘S4’, ‘RFI’, ‘elevation’, ‘occheight’, ‘caL1_SNR’, ‘pL2_SNR’, ‘x_LEO’, ‘y_LEO’, ‘z_LEO’, ‘x_GPS’, ‘y_GPS’, ‘z_GPS’}, variable_names))
% Extract the date and type information from the file name
[~, filename, ~] = fileparts(fileList(fileIndex).name);
dateStr = regexp(filename, ‘d{4}.d{3}’, ‘match’, ‘once’);
typeStr = regexp(filename, ‘Gd{2}|Rd{2}’, ‘match’, ‘once’);
% Read the data from the NetCDF file
data{fileIndex}.time = ncread(filePath, ‘time’);
data{fileIndex}.TEC = ncread(filePath, ‘TEC’);
data{fileIndex}.S4 = ncread(filePath, ‘S4’);
data{fileIndex}.RFI = ncread(filePath, ‘RFI’);
data{fileIndex}.elevation = ncread(filePath, ‘elevation’);
data{fileIndex}.occheight = ncread(filePath, ‘occheight’);
data{fileIndex}.caL1_SNR = ncread(filePath, ‘caL1_SNR’);
data{fileIndex}.pL2_SNR = ncread(filePath, ‘pL2_SNR’);
data{fileIndex}.x_LEO = ncread(filePath, ‘x_LEO’);
data{fileIndex}.y_LEO = ncread(filePath, ‘y_LEO’);
data{fileIndex}.z_LEO = ncread(filePath, ‘z_LEO’);
data{fileIndex}.x_GPS = ncread(filePath, ‘x_GPS’);
data{fileIndex}.y_GPS = ncread(filePath, ‘y_GPS’);
data{fileIndex}.z_GPS = ncread(filePath, ‘z_GPS’);
% Store the date and type information
dateArray = [dateArray, str2double(dateStr)];
typeArray{fileIndex} = typeStr;
else
% Skip this file and move on to the next one
fprintf(‘File "%s" does not contain all the required variables. Skipping this file.n’, fileList(fileIndex).name);
continue;
end
else
% Skip this file and move on to the next one
fprintf(‘File "%s" does not contain the "Variables" field. Skipping this file.n’, fileList(fileIndex).name);
continue;
end
end
% Sort the data by date and type
[sortedDates, sortedIndices] = sort(dateArray);
sortedTypes = cellfun(@(x) x, typeArray(sortedIndices), ‘UniformOutput’, false);
% Create the sorted data structures
sortedData = cell(numFiles, 1);
for i = 1:numFiles
sortedData{i} = data{sortedIndices(i)};
end
% Save the data to a .mat file
save(‘podtc_apr_data.mat’, ‘sortedData’, ‘sortedDates’, ‘sortedTypes’); Dear All,
I have this code but when I run it it takes one day and half to run. How can I speed it up?
Best regards,
Ara
clear all;
clc;
% Set the folder path where the .nc files are located
folderPath = ‘E:datapodtc_apr’;
% Get a list of all NetCDF files in the folder
fileList = dir(fullfile(folderPath, ‘*_nc’));
numFiles = numel(fileList);
% Initialize the data structures
data = cell(numFiles, 1);
dateArray = [];
typeArray = cell(numFiles, 1);
% Loop through each file
for fileIndex = 1:numFiles
% Read the NetCDF file
filePath = fullfile(folderPath, fileList(fileIndex).name);
% Read the data from the NetCDF file
ncinfo_struct = ncinfo(filePath);
if isfield(ncinfo_struct, ‘Variables’)
variable_names = {ncinfo_struct.Variables.Name};
if all(ismember({‘time’, ‘TEC’, ‘S4’, ‘RFI’, ‘elevation’, ‘occheight’, ‘caL1_SNR’, ‘pL2_SNR’, ‘x_LEO’, ‘y_LEO’, ‘z_LEO’, ‘x_GPS’, ‘y_GPS’, ‘z_GPS’}, variable_names))
% Extract the date and type information from the file name
[~, filename, ~] = fileparts(fileList(fileIndex).name);
dateStr = regexp(filename, ‘d{4}.d{3}’, ‘match’, ‘once’);
typeStr = regexp(filename, ‘Gd{2}|Rd{2}’, ‘match’, ‘once’);
% Read the data from the NetCDF file
data{fileIndex}.time = ncread(filePath, ‘time’);
data{fileIndex}.TEC = ncread(filePath, ‘TEC’);
data{fileIndex}.S4 = ncread(filePath, ‘S4’);
data{fileIndex}.RFI = ncread(filePath, ‘RFI’);
data{fileIndex}.elevation = ncread(filePath, ‘elevation’);
data{fileIndex}.occheight = ncread(filePath, ‘occheight’);
data{fileIndex}.caL1_SNR = ncread(filePath, ‘caL1_SNR’);
data{fileIndex}.pL2_SNR = ncread(filePath, ‘pL2_SNR’);
data{fileIndex}.x_LEO = ncread(filePath, ‘x_LEO’);
data{fileIndex}.y_LEO = ncread(filePath, ‘y_LEO’);
data{fileIndex}.z_LEO = ncread(filePath, ‘z_LEO’);
data{fileIndex}.x_GPS = ncread(filePath, ‘x_GPS’);
data{fileIndex}.y_GPS = ncread(filePath, ‘y_GPS’);
data{fileIndex}.z_GPS = ncread(filePath, ‘z_GPS’);
% Store the date and type information
dateArray = [dateArray, str2double(dateStr)];
typeArray{fileIndex} = typeStr;
else
% Skip this file and move on to the next one
fprintf(‘File "%s" does not contain all the required variables. Skipping this file.n’, fileList(fileIndex).name);
continue;
end
else
% Skip this file and move on to the next one
fprintf(‘File "%s" does not contain the "Variables" field. Skipping this file.n’, fileList(fileIndex).name);
continue;
end
end
% Sort the data by date and type
[sortedDates, sortedIndices] = sort(dateArray);
sortedTypes = cellfun(@(x) x, typeArray(sortedIndices), ‘UniformOutput’, false);
% Create the sorted data structures
sortedData = cell(numFiles, 1);
for i = 1:numFiles
sortedData{i} = data{sortedIndices(i)};
end
% Save the data to a .mat file
save(‘podtc_apr_data.mat’, ‘sortedData’, ‘sortedDates’, ‘sortedTypes’); speed up run MATLAB Answers — New Questions
what is the meaning of error “Index exceeds the number of array elements. Index must not exceed 8.”
function Latest_code
%%
for Pr = [1 2 3 4]
% Define constants
M = 0.5;
B = 0.5;
C = 0.2;
A = 0.1;
R = 0.1;
E = 0.1;
K = 0.5;
W = 0.1;
N = 0.1;
T = 0.3;
Q = 0.1;
N1 = 0.1;
N2 = 0.1;
S = 0.1;
d = 1;
m = 1;
E1 = 0.1;
Pe = 0.2;
S1 = 0.1;
M1 = 0.1;
O = 0.1;
% Defining initial guess
solinit = bvpinit(linspace(0, 2, 50), [1 0 0 0 1 1 1 1]);
% Solving the boundary value problem
sol = bvp4c(@bvpexam2, @bcexam2, solinit);
x = sol.x;
y = sol.y;
% Plotting of velocity
figure(2)
plot(x, y(4, :), ‘linewidth’, 1)
ylim([0 1])
xlim([0 9])
hold on
xlabel(‘eta’, ‘FontWeight’, ‘bold’, ‘FontSize’, 16)
ylabel(‘theta(eta)’, ‘FontWeight’, ‘bold’, ‘FontSize’, 16)
end
% System of first order ODEs
function yvector = bvpexam2(~, y)
yy1 = (1 / (1 + (1 / B))) * (2 * y(2) * y(2) – y(1) * y(3) + M * y(2) + K * y(2) – W * (y(4) – N * y(7) – R));
yy2 = -(1 / (((4 / 3) * R) + 1)) * (Pr * (y(1) * y(5) – y(2) * y(4) – T * y(2) + Q * y(4) + N1 * y(8) * y(5) + N2 * y(5) * y(5) + E * (1 + 1 / B) * y(3) * y(3) + (E * y(2) * y(2)) * (M + K)));
yy3 = -S * (y(1) * y(8) – y(2) * y(7) – C * y(2) – A * y(7) * ((1 + d * y(4)) ^ m) * exp(-E1 / (1 + d * y(4)))) – (N2 / N1) * y(6);
yy4 = (Pe * (y(9) * (y(10) + O) + y(11) * y(8))) – (S1 * ((y(11) – y(10)) * y(1))) + (S1 * M1 * y(2));
yvector = [ y(2); y(3); yy1; y(5); yy2; y(8); yy3 ; y(11); yy4 ];
end
% Residual of the boundary conditions
function residual = bcexam2(y0, yinf)
residual = [y0(1)- 1; y0(2) – 1; y0(4) – 1 +T ; y0(7)-1+C ; y0(10)-1+M1 ; yinf(2); yinf(4); yinf(7); yinf(10)];
end
endfunction Latest_code
%%
for Pr = [1 2 3 4]
% Define constants
M = 0.5;
B = 0.5;
C = 0.2;
A = 0.1;
R = 0.1;
E = 0.1;
K = 0.5;
W = 0.1;
N = 0.1;
T = 0.3;
Q = 0.1;
N1 = 0.1;
N2 = 0.1;
S = 0.1;
d = 1;
m = 1;
E1 = 0.1;
Pe = 0.2;
S1 = 0.1;
M1 = 0.1;
O = 0.1;
% Defining initial guess
solinit = bvpinit(linspace(0, 2, 50), [1 0 0 0 1 1 1 1]);
% Solving the boundary value problem
sol = bvp4c(@bvpexam2, @bcexam2, solinit);
x = sol.x;
y = sol.y;
% Plotting of velocity
figure(2)
plot(x, y(4, :), ‘linewidth’, 1)
ylim([0 1])
xlim([0 9])
hold on
xlabel(‘eta’, ‘FontWeight’, ‘bold’, ‘FontSize’, 16)
ylabel(‘theta(eta)’, ‘FontWeight’, ‘bold’, ‘FontSize’, 16)
end
% System of first order ODEs
function yvector = bvpexam2(~, y)
yy1 = (1 / (1 + (1 / B))) * (2 * y(2) * y(2) – y(1) * y(3) + M * y(2) + K * y(2) – W * (y(4) – N * y(7) – R));
yy2 = -(1 / (((4 / 3) * R) + 1)) * (Pr * (y(1) * y(5) – y(2) * y(4) – T * y(2) + Q * y(4) + N1 * y(8) * y(5) + N2 * y(5) * y(5) + E * (1 + 1 / B) * y(3) * y(3) + (E * y(2) * y(2)) * (M + K)));
yy3 = -S * (y(1) * y(8) – y(2) * y(7) – C * y(2) – A * y(7) * ((1 + d * y(4)) ^ m) * exp(-E1 / (1 + d * y(4)))) – (N2 / N1) * y(6);
yy4 = (Pe * (y(9) * (y(10) + O) + y(11) * y(8))) – (S1 * ((y(11) – y(10)) * y(1))) + (S1 * M1 * y(2));
yvector = [ y(2); y(3); yy1; y(5); yy2; y(8); yy3 ; y(11); yy4 ];
end
% Residual of the boundary conditions
function residual = bcexam2(y0, yinf)
residual = [y0(1)- 1; y0(2) – 1; y0(4) – 1 +T ; y0(7)-1+C ; y0(10)-1+M1 ; yinf(2); yinf(4); yinf(7); yinf(10)];
end
end function Latest_code
%%
for Pr = [1 2 3 4]
% Define constants
M = 0.5;
B = 0.5;
C = 0.2;
A = 0.1;
R = 0.1;
E = 0.1;
K = 0.5;
W = 0.1;
N = 0.1;
T = 0.3;
Q = 0.1;
N1 = 0.1;
N2 = 0.1;
S = 0.1;
d = 1;
m = 1;
E1 = 0.1;
Pe = 0.2;
S1 = 0.1;
M1 = 0.1;
O = 0.1;
% Defining initial guess
solinit = bvpinit(linspace(0, 2, 50), [1 0 0 0 1 1 1 1]);
% Solving the boundary value problem
sol = bvp4c(@bvpexam2, @bcexam2, solinit);
x = sol.x;
y = sol.y;
% Plotting of velocity
figure(2)
plot(x, y(4, :), ‘linewidth’, 1)
ylim([0 1])
xlim([0 9])
hold on
xlabel(‘eta’, ‘FontWeight’, ‘bold’, ‘FontSize’, 16)
ylabel(‘theta(eta)’, ‘FontWeight’, ‘bold’, ‘FontSize’, 16)
end
% System of first order ODEs
function yvector = bvpexam2(~, y)
yy1 = (1 / (1 + (1 / B))) * (2 * y(2) * y(2) – y(1) * y(3) + M * y(2) + K * y(2) – W * (y(4) – N * y(7) – R));
yy2 = -(1 / (((4 / 3) * R) + 1)) * (Pr * (y(1) * y(5) – y(2) * y(4) – T * y(2) + Q * y(4) + N1 * y(8) * y(5) + N2 * y(5) * y(5) + E * (1 + 1 / B) * y(3) * y(3) + (E * y(2) * y(2)) * (M + K)));
yy3 = -S * (y(1) * y(8) – y(2) * y(7) – C * y(2) – A * y(7) * ((1 + d * y(4)) ^ m) * exp(-E1 / (1 + d * y(4)))) – (N2 / N1) * y(6);
yy4 = (Pe * (y(9) * (y(10) + O) + y(11) * y(8))) – (S1 * ((y(11) – y(10)) * y(1))) + (S1 * M1 * y(2));
yvector = [ y(2); y(3); yy1; y(5); yy2; y(8); yy3 ; y(11); yy4 ];
end
% Residual of the boundary conditions
function residual = bcexam2(y0, yinf)
residual = [y0(1)- 1; y0(2) – 1; y0(4) – 1 +T ; y0(7)-1+C ; y0(10)-1+M1 ; yinf(2); yinf(4); yinf(7); yinf(10)];
end
end fluidmechanics MATLAB Answers — New Questions
Why do I receive an error that the MATLAB Parallel Server service launched but failed to start?
When starting mjs on my Windows machine I receive the following error:
wrapper | Starting the MATLAB Parallel Server service…
wrapper | The MATLAB Parallel Server service was launched, but failed to start.
When checking the mjs-service.log I see the following error:
ERROR: STATUS | wrapper | 2014/07/22 09:47:17 | Starting the MATLAB Parallel Server service…
STATUS | wrapper | 2014/07/22 09:47:17 | –> Wrapper Started as Service
STATUS | wrapper | 2014/07/22 09:47:17 | Launching a JVM…
INFO | jvm 1 | 2014/07/22 09:47:17 | Wrapper (Version 3.1.2) https://wrapper.tanukisoftware.com/doc/english/home.html
INFO | jvm 1 | 2014/07/22 09:47:17 |
INFO | jvm 1 | 2014/07/22 09:47:17 |
INFO | jvm 1 | 2014/07/22 09:47:17 | WrapperSimpleApp: Encountered an error running main: java.lang.NoClassDefFoundError: com/mathworks/resource_core/BaseMsgID
INFO | jvm 1 | 2014/07/22 09:47:17 | java.lang.NoClassDefFoundError: com/mathworks/resource_core/BaseMsgID
INFO | jvm 1 | 2014/07/22 09:47:17 | at com.mathworks.toolbox.distcomp.control.Starter.run(Starter.java:241)
INFO | jvm 1 | 2014/07/22 09:47:17 | at com.mathworks.toolbox.distcomp.control.Starter.main(Starter.java:723)
INFO | jvm 1 | 2014/07/22 09:47:17 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
INFO | jvm 1 | 2014/07/22 09:47:17 | at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
INFO | jvm 1 | 2014/07/22 09:47:17 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
INFO | jvm 1 | 2014/07/22 09:47:17 | at java.lang.reflect.Method.invoke(Unknown Source)
INFO | jvm 1 | 2014/07/22 09:47:17 | at org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java:136)
INFO | jvm 1 | 2014/07/22 09:47:17 | at java.lang.Thread.run(Unknown Source)
INFO | jvm 1 | 2014/07/22 09:47:17 | Caused by: java.lang.ClassNotFoundException: com.mathworks.resource_core.BaseMsgID
INFO | jvm 1 | 2014/07/22 09:47:17 | at java.net.URLClassLoader$1.run(Unknown Source)
INFO | jvm 1 | 2014/07/22 09:47:17 | at java.net.URLClassLoader$1.run(Unknown Source)
INFO | jvm 1 | 2014/07/22 09:47:17 | at java.security.AccessController.doPrivileged(Native Method)
INFO | jvm 1 | 2014/07/22 09:47:17 | at java.net.URLClassLoader.findClass(Unknown Source)
INFO | jvm 1 | 2014/07/22 09:47:17 | at java.lang.ClassLoader.loadClass(Unknown Source)
INFO | jvm 1 | 2014/07/22 09:47:17 | at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
INFO | jvm 1 | 2014/07/22 09:47:17 | at java.lang.ClassLoader.loadClass(Unknown Source)
INFO | jvm 1 | 2014/07/22 09:47:17 | … 8 more
STATUS | wrapper | 2014/07/22 09:47:19 | <– Wrapper Stopped
ERROR | wrapper | 2014/07/22 09:47:21 | The MATLAB Parallel Server service was launched, but failed to start.When starting mjs on my Windows machine I receive the following error:
wrapper | Starting the MATLAB Parallel Server service…
wrapper | The MATLAB Parallel Server service was launched, but failed to start.
When checking the mjs-service.log I see the following error:
ERROR: STATUS | wrapper | 2014/07/22 09:47:17 | Starting the MATLAB Parallel Server service…
STATUS | wrapper | 2014/07/22 09:47:17 | –> Wrapper Started as Service
STATUS | wrapper | 2014/07/22 09:47:17 | Launching a JVM…
INFO | jvm 1 | 2014/07/22 09:47:17 | Wrapper (Version 3.1.2) https://wrapper.tanukisoftware.com/doc/english/home.html
INFO | jvm 1 | 2014/07/22 09:47:17 |
INFO | jvm 1 | 2014/07/22 09:47:17 |
INFO | jvm 1 | 2014/07/22 09:47:17 | WrapperSimpleApp: Encountered an error running main: java.lang.NoClassDefFoundError: com/mathworks/resource_core/BaseMsgID
INFO | jvm 1 | 2014/07/22 09:47:17 | java.lang.NoClassDefFoundError: com/mathworks/resource_core/BaseMsgID
INFO | jvm 1 | 2014/07/22 09:47:17 | at com.mathworks.toolbox.distcomp.control.Starter.run(Starter.java:241)
INFO | jvm 1 | 2014/07/22 09:47:17 | at com.mathworks.toolbox.distcomp.control.Starter.main(Starter.java:723)
INFO | jvm 1 | 2014/07/22 09:47:17 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
INFO | jvm 1 | 2014/07/22 09:47:17 | at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
INFO | jvm 1 | 2014/07/22 09:47:17 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
INFO | jvm 1 | 2014/07/22 09:47:17 | at java.lang.reflect.Method.invoke(Unknown Source)
INFO | jvm 1 | 2014/07/22 09:47:17 | at org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java:136)
INFO | jvm 1 | 2014/07/22 09:47:17 | at java.lang.Thread.run(Unknown Source)
INFO | jvm 1 | 2014/07/22 09:47:17 | Caused by: java.lang.ClassNotFoundException: com.mathworks.resource_core.BaseMsgID
INFO | jvm 1 | 2014/07/22 09:47:17 | at java.net.URLClassLoader$1.run(Unknown Source)
INFO | jvm 1 | 2014/07/22 09:47:17 | at java.net.URLClassLoader$1.run(Unknown Source)
INFO | jvm 1 | 2014/07/22 09:47:17 | at java.security.AccessController.doPrivileged(Native Method)
INFO | jvm 1 | 2014/07/22 09:47:17 | at java.net.URLClassLoader.findClass(Unknown Source)
INFO | jvm 1 | 2014/07/22 09:47:17 | at java.lang.ClassLoader.loadClass(Unknown Source)
INFO | jvm 1 | 2014/07/22 09:47:17 | at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
INFO | jvm 1 | 2014/07/22 09:47:17 | at java.lang.ClassLoader.loadClass(Unknown Source)
INFO | jvm 1 | 2014/07/22 09:47:17 | … 8 more
STATUS | wrapper | 2014/07/22 09:47:19 | <– Wrapper Stopped
ERROR | wrapper | 2014/07/22 09:47:21 | The MATLAB Parallel Server service was launched, but failed to start. When starting mjs on my Windows machine I receive the following error:
wrapper | Starting the MATLAB Parallel Server service…
wrapper | The MATLAB Parallel Server service was launched, but failed to start.
When checking the mjs-service.log I see the following error:
ERROR: STATUS | wrapper | 2014/07/22 09:47:17 | Starting the MATLAB Parallel Server service…
STATUS | wrapper | 2014/07/22 09:47:17 | –> Wrapper Started as Service
STATUS | wrapper | 2014/07/22 09:47:17 | Launching a JVM…
INFO | jvm 1 | 2014/07/22 09:47:17 | Wrapper (Version 3.1.2) https://wrapper.tanukisoftware.com/doc/english/home.html
INFO | jvm 1 | 2014/07/22 09:47:17 |
INFO | jvm 1 | 2014/07/22 09:47:17 |
INFO | jvm 1 | 2014/07/22 09:47:17 | WrapperSimpleApp: Encountered an error running main: java.lang.NoClassDefFoundError: com/mathworks/resource_core/BaseMsgID
INFO | jvm 1 | 2014/07/22 09:47:17 | java.lang.NoClassDefFoundError: com/mathworks/resource_core/BaseMsgID
INFO | jvm 1 | 2014/07/22 09:47:17 | at com.mathworks.toolbox.distcomp.control.Starter.run(Starter.java:241)
INFO | jvm 1 | 2014/07/22 09:47:17 | at com.mathworks.toolbox.distcomp.control.Starter.main(Starter.java:723)
INFO | jvm 1 | 2014/07/22 09:47:17 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
INFO | jvm 1 | 2014/07/22 09:47:17 | at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
INFO | jvm 1 | 2014/07/22 09:47:17 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
INFO | jvm 1 | 2014/07/22 09:47:17 | at java.lang.reflect.Method.invoke(Unknown Source)
INFO | jvm 1 | 2014/07/22 09:47:17 | at org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java:136)
INFO | jvm 1 | 2014/07/22 09:47:17 | at java.lang.Thread.run(Unknown Source)
INFO | jvm 1 | 2014/07/22 09:47:17 | Caused by: java.lang.ClassNotFoundException: com.mathworks.resource_core.BaseMsgID
INFO | jvm 1 | 2014/07/22 09:47:17 | at java.net.URLClassLoader$1.run(Unknown Source)
INFO | jvm 1 | 2014/07/22 09:47:17 | at java.net.URLClassLoader$1.run(Unknown Source)
INFO | jvm 1 | 2014/07/22 09:47:17 | at java.security.AccessController.doPrivileged(Native Method)
INFO | jvm 1 | 2014/07/22 09:47:17 | at java.net.URLClassLoader.findClass(Unknown Source)
INFO | jvm 1 | 2014/07/22 09:47:17 | at java.lang.ClassLoader.loadClass(Unknown Source)
INFO | jvm 1 | 2014/07/22 09:47:17 | at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
INFO | jvm 1 | 2014/07/22 09:47:17 | at java.lang.ClassLoader.loadClass(Unknown Source)
INFO | jvm 1 | 2014/07/22 09:47:17 | … 8 more
STATUS | wrapper | 2014/07/22 09:47:19 | <– Wrapper Stopped
ERROR | wrapper | 2014/07/22 09:47:21 | The MATLAB Parallel Server service was launched, but failed to start. MATLAB Answers — New Questions
Cannot send PWM signals over telemetry with Connected IO to Pixhawk
I am currently able to send PWM signals over USB to my Holybro Pixhawk 6x to run my drone’s motors in Connected IO mode from Simulink. However, I need to run it while communicating over telemetry. I have a pair of telemetry modules (successfully paired to each other). One is on the Pixhawk /dev/ttyS1 port, and the other is on a Windows host computer COM5 port.
When I look in “Configuration Parameters -> Hardware Implementation -> Hardware board settings -> Target hardware resources” -> "Connected IO", I am unable to change the “Hardware board serial port” from “/dev/ttyACM0” (the Pixhawk-side USB port) to “/dev/ttyS1”, (the Pixhawk-side telemetry unit).I am currently able to send PWM signals over USB to my Holybro Pixhawk 6x to run my drone’s motors in Connected IO mode from Simulink. However, I need to run it while communicating over telemetry. I have a pair of telemetry modules (successfully paired to each other). One is on the Pixhawk /dev/ttyS1 port, and the other is on a Windows host computer COM5 port.
When I look in “Configuration Parameters -> Hardware Implementation -> Hardware board settings -> Target hardware resources” -> "Connected IO", I am unable to change the “Hardware board serial port” from “/dev/ttyACM0” (the Pixhawk-side USB port) to “/dev/ttyS1”, (the Pixhawk-side telemetry unit). I am currently able to send PWM signals over USB to my Holybro Pixhawk 6x to run my drone’s motors in Connected IO mode from Simulink. However, I need to run it while communicating over telemetry. I have a pair of telemetry modules (successfully paired to each other). One is on the Pixhawk /dev/ttyS1 port, and the other is on a Windows host computer COM5 port.
When I look in “Configuration Parameters -> Hardware Implementation -> Hardware board settings -> Target hardware resources” -> "Connected IO", I am unable to change the “Hardware board serial port” from “/dev/ttyACM0” (the Pixhawk-side USB port) to “/dev/ttyS1”, (the Pixhawk-side telemetry unit). px4, pixhawk, connected, io, mode, external MATLAB Answers — New Questions
partial differential equation solve
hi.i need help to write this equation and solve it in matlab.thanks.hi.i need help to write this equation and solve it in matlab.thanks. hi.i need help to write this equation and solve it in matlab.thanks. partial equation MATLAB Answers — New Questions
PV Array unable to connect with Blue N-Channel MOSFET
Object : I trying to simulate a MOSFET Based IV Tracer for PV Module.
Problem :
There have 2 type of MOSFET, first is the Black MOSFET which is under a same category with PV Array and only can adjust a very few parameter. While the second is Blue MOSFET which isn’t under a same category with PV Array but adjust much more parameter that from a real MOSFET datasheet, and the model converted from LTSpice lib also under this category.
Black MOSFET is able to connect with PV Array but Blue MOSFET cant. The reason i sent this email is because the Black MOSFET can’t simualte a normal MOSFET Characteristic IV Curve but Blue one can.
Question / Ask :
Is it possible to connect the N-Channel Mosfet(Blue) with PV-Array ? (I tried both PS-Simulink Converter)Object : I trying to simulate a MOSFET Based IV Tracer for PV Module.
Problem :
There have 2 type of MOSFET, first is the Black MOSFET which is under a same category with PV Array and only can adjust a very few parameter. While the second is Blue MOSFET which isn’t under a same category with PV Array but adjust much more parameter that from a real MOSFET datasheet, and the model converted from LTSpice lib also under this category.
Black MOSFET is able to connect with PV Array but Blue MOSFET cant. The reason i sent this email is because the Black MOSFET can’t simualte a normal MOSFET Characteristic IV Curve but Blue one can.
Question / Ask :
Is it possible to connect the N-Channel Mosfet(Blue) with PV-Array ? (I tried both PS-Simulink Converter) Object : I trying to simulate a MOSFET Based IV Tracer for PV Module.
Problem :
There have 2 type of MOSFET, first is the Black MOSFET which is under a same category with PV Array and only can adjust a very few parameter. While the second is Blue MOSFET which isn’t under a same category with PV Array but adjust much more parameter that from a real MOSFET datasheet, and the model converted from LTSpice lib also under this category.
Black MOSFET is able to connect with PV Array but Blue MOSFET cant. The reason i sent this email is because the Black MOSFET can’t simualte a normal MOSFET Characteristic IV Curve but Blue one can.
Question / Ask :
Is it possible to connect the N-Channel Mosfet(Blue) with PV-Array ? (I tried both PS-Simulink Converter) simulink, simscape, pv array, mosfet, connection, problem, matlab MATLAB Answers — New Questions
How to set specific colors in margin of errorbars line?
I use errorbar funtion in order to put errorbars in a plot. I would like to set a different color to the margin of the line.
I use
errorbar(x,y,z,’r-‘,’LineWidth’,3)
I would like for example to have red line with black margins..
Could you help me?I use errorbar funtion in order to put errorbars in a plot. I would like to set a different color to the margin of the line.
I use
errorbar(x,y,z,’r-‘,’LineWidth’,3)
I would like for example to have red line with black margins..
Could you help me? I use errorbar funtion in order to put errorbars in a plot. I would like to set a different color to the margin of the line.
I use
errorbar(x,y,z,’r-‘,’LineWidth’,3)
I would like for example to have red line with black margins..
Could you help me? errorbars, colors, set, matlab MATLAB Answers — New Questions
how can I detect and fill gapes in data
hello everyone.. im working with snow data in which present in one colon time and in other colon other parameter… and I have some missing value with pass of 7 minutes..now I would like to fill this gaps of 7 minutes with the interval of time so the last interval of time after this gaps… can someone help me please?hello everyone.. im working with snow data in which present in one colon time and in other colon other parameter… and I have some missing value with pass of 7 minutes..now I would like to fill this gaps of 7 minutes with the interval of time so the last interval of time after this gaps… can someone help me please? hello everyone.. im working with snow data in which present in one colon time and in other colon other parameter… and I have some missing value with pass of 7 minutes..now I would like to fill this gaps of 7 minutes with the interval of time so the last interval of time after this gaps… can someone help me please? data MATLAB Answers — New Questions
When using Matlab engine and calling from multiple ranks, does each rank use one Matlab license?
I’m trying to write a python code that will call a Matlab function compiled for python. I need to know if, when running this code using multiple MPI processes, will each need one instance of Matlab? Will this be a potential bottleneck in opening multiple instances of Matlab?I’m trying to write a python code that will call a Matlab function compiled for python. I need to know if, when running this code using multiple MPI processes, will each need one instance of Matlab? Will this be a potential bottleneck in opening multiple instances of Matlab? I’m trying to write a python code that will call a Matlab function compiled for python. I need to know if, when running this code using multiple MPI processes, will each need one instance of Matlab? Will this be a potential bottleneck in opening multiple instances of Matlab? python, engine, license MATLAB Answers — New Questions
puzzles on using mutiple “addOptional” in function definitions
How to use multiple |addOptional| in function definitions?
|addOptional| is to add positional arguments. So I want to use it
in the following way.
* First I define the function and use two
|addOptional| there.
* Then I thought I can call in the following
two ways:
|myfunc(‘Jim’, 12)| and |myfunc(‘Jim’, 12, ‘cm’)|.
However, the latter one throws an error:
_The argument ‘cm’ is a string and does not match any parameter names. It failed validation
for the argument ‘units’._
But I can use as |myfunc(‘Jim’, 12, ‘units’, ‘cm’)|, which seems the second |addOptional| behaves as |addParameter|, no longer like positional arguments. What’s the mistake I made? Did I misunderstand something about |addOptional|? Many thanks!
Here is the definition of |myfunc()|:
function myfunc(name, varargin)
par = inputParser;
defaultHeight = 1;
defaultUnits = ‘inches’;
defaultShape = ‘rectangle’;
expectedShape = {‘square’, ‘rectangle’, ‘parallelogram’};
addRequired(par, ‘name’, @ischar);
addOptional(par, ‘height’, defaultHeight, @isnumeric);
addOptional(par, ‘units’, defaultUnits);
% addParameter(par, ‘shape’, defaultShape, …
% @(x) any(validatestring(x,expectedShape)));
parse(par, name, varargin{:});
disp(par.Results)
———
*Updates*:
I found that if the positional arguments are NOT literal string (maybe called as character array in helpdoc, the type shown by whos is char, e.g. ‘any words’), there would be no problems. For example, use |myfunc(‘Jim’, 3, 4)| which is defined as
function myfunc(name, varargin)
p = inputParser;
addRequired(p, ‘name’);
addOptional(p, ‘i’, 1);
addOptional(p, ‘j’, 2);
parse(p, name, varargin{:});
disp(p.Results)
The MATLAB help doc doesn’t mention anything about the limitations in data types of additional positional arguments. Does it imply this is a bug?
*Info*:
* MATLAB: 2016a
* OS: OS X SierraHow to use multiple |addOptional| in function definitions?
|addOptional| is to add positional arguments. So I want to use it
in the following way.
* First I define the function and use two
|addOptional| there.
* Then I thought I can call in the following
two ways:
|myfunc(‘Jim’, 12)| and |myfunc(‘Jim’, 12, ‘cm’)|.
However, the latter one throws an error:
_The argument ‘cm’ is a string and does not match any parameter names. It failed validation
for the argument ‘units’._
But I can use as |myfunc(‘Jim’, 12, ‘units’, ‘cm’)|, which seems the second |addOptional| behaves as |addParameter|, no longer like positional arguments. What’s the mistake I made? Did I misunderstand something about |addOptional|? Many thanks!
Here is the definition of |myfunc()|:
function myfunc(name, varargin)
par = inputParser;
defaultHeight = 1;
defaultUnits = ‘inches’;
defaultShape = ‘rectangle’;
expectedShape = {‘square’, ‘rectangle’, ‘parallelogram’};
addRequired(par, ‘name’, @ischar);
addOptional(par, ‘height’, defaultHeight, @isnumeric);
addOptional(par, ‘units’, defaultUnits);
% addParameter(par, ‘shape’, defaultShape, …
% @(x) any(validatestring(x,expectedShape)));
parse(par, name, varargin{:});
disp(par.Results)
———
*Updates*:
I found that if the positional arguments are NOT literal string (maybe called as character array in helpdoc, the type shown by whos is char, e.g. ‘any words’), there would be no problems. For example, use |myfunc(‘Jim’, 3, 4)| which is defined as
function myfunc(name, varargin)
p = inputParser;
addRequired(p, ‘name’);
addOptional(p, ‘i’, 1);
addOptional(p, ‘j’, 2);
parse(p, name, varargin{:});
disp(p.Results)
The MATLAB help doc doesn’t mention anything about the limitations in data types of additional positional arguments. Does it imply this is a bug?
*Info*:
* MATLAB: 2016a
* OS: OS X Sierra How to use multiple |addOptional| in function definitions?
|addOptional| is to add positional arguments. So I want to use it
in the following way.
* First I define the function and use two
|addOptional| there.
* Then I thought I can call in the following
two ways:
|myfunc(‘Jim’, 12)| and |myfunc(‘Jim’, 12, ‘cm’)|.
However, the latter one throws an error:
_The argument ‘cm’ is a string and does not match any parameter names. It failed validation
for the argument ‘units’._
But I can use as |myfunc(‘Jim’, 12, ‘units’, ‘cm’)|, which seems the second |addOptional| behaves as |addParameter|, no longer like positional arguments. What’s the mistake I made? Did I misunderstand something about |addOptional|? Many thanks!
Here is the definition of |myfunc()|:
function myfunc(name, varargin)
par = inputParser;
defaultHeight = 1;
defaultUnits = ‘inches’;
defaultShape = ‘rectangle’;
expectedShape = {‘square’, ‘rectangle’, ‘parallelogram’};
addRequired(par, ‘name’, @ischar);
addOptional(par, ‘height’, defaultHeight, @isnumeric);
addOptional(par, ‘units’, defaultUnits);
% addParameter(par, ‘shape’, defaultShape, …
% @(x) any(validatestring(x,expectedShape)));
parse(par, name, varargin{:});
disp(par.Results)
———
*Updates*:
I found that if the positional arguments are NOT literal string (maybe called as character array in helpdoc, the type shown by whos is char, e.g. ‘any words’), there would be no problems. For example, use |myfunc(‘Jim’, 3, 4)| which is defined as
function myfunc(name, varargin)
p = inputParser;
addRequired(p, ‘name’);
addOptional(p, ‘i’, 1);
addOptional(p, ‘j’, 2);
parse(p, name, varargin{:});
disp(p.Results)
The MATLAB help doc doesn’t mention anything about the limitations in data types of additional positional arguments. Does it imply this is a bug?
*Info*:
* MATLAB: 2016a
* OS: OS X Sierra addoptional, inputparser MATLAB Answers — New Questions
Does MATLAB work with Qualcomm arm processors? For example, Microsoft surface pro 11 with X Elite processor, and Windows 11 on Arm.
Qualcomm has released its latest X Elite processor and I really like its long battery life and low carbon footprint. I would like to ask the community if matlab runs well on windows on arm platform through an emulator? Will it affect normal ploting and coding? OS version:the latest Windows 11 on Arm.
Thank you!Qualcomm has released its latest X Elite processor and I really like its long battery life and low carbon footprint. I would like to ask the community if matlab runs well on windows on arm platform through an emulator? Will it affect normal ploting and coding? OS version:the latest Windows 11 on Arm.
Thank you! Qualcomm has released its latest X Elite processor and I really like its long battery life and low carbon footprint. I would like to ask the community if matlab runs well on windows on arm platform through an emulator? Will it affect normal ploting and coding? OS version:the latest Windows 11 on Arm.
Thank you! windows 11 on arm MATLAB Answers — New Questions
Flexible Body Model Builder – Equations used inside the package
Hi,
I am experimenting with the Flexible body builder app and have some questions regarding the math behind it’s implementation.
StiffnessMatrix: I understand that the stiffness matrix in the output ROM data is calculated from the Young’s modulus and the poison’s ratio. But I want to change this young’s modulus with every run of the simulation without building the flexible body ROM from scratch. For this, I first export the ROM data with E = 1MPa, define the flexible body using the exported ROM data in simscape, and multiply the stiffness matrix with E_flex which is the variable I want to change with every simulation run.
This is because K = EA/L and since E is a scalar, it can be scaled up or down with just a simple scalar multiplication.
I did some experimentation of this usage by exporting stiffness matrices for E = 1MPa, 2MPa,…etc and I can verify that
det ([StiffnessMat.2MPa]-2*[StiffnessMat.1MPa]) = 0
It would be great if you could verify this usage.
Number of Fixed-Interface Normal Modes: What is the optimal number of frequency modes to retain for a given geometry? It would depend on the geometry and the loading conditions themselves. Is there a way to assess what’s a good estimate for this?
Algorithm for model Generation: Is there a quantitative difference between the included integro-differential modeling framework and the PDE toolbox? What is the difference between the two methods. What is the recommended method?
It’d be great if you could provide some insights into these areas.Hi,
I am experimenting with the Flexible body builder app and have some questions regarding the math behind it’s implementation.
StiffnessMatrix: I understand that the stiffness matrix in the output ROM data is calculated from the Young’s modulus and the poison’s ratio. But I want to change this young’s modulus with every run of the simulation without building the flexible body ROM from scratch. For this, I first export the ROM data with E = 1MPa, define the flexible body using the exported ROM data in simscape, and multiply the stiffness matrix with E_flex which is the variable I want to change with every simulation run.
This is because K = EA/L and since E is a scalar, it can be scaled up or down with just a simple scalar multiplication.
I did some experimentation of this usage by exporting stiffness matrices for E = 1MPa, 2MPa,…etc and I can verify that
det ([StiffnessMat.2MPa]-2*[StiffnessMat.1MPa]) = 0
It would be great if you could verify this usage.
Number of Fixed-Interface Normal Modes: What is the optimal number of frequency modes to retain for a given geometry? It would depend on the geometry and the loading conditions themselves. Is there a way to assess what’s a good estimate for this?
Algorithm for model Generation: Is there a quantitative difference between the included integro-differential modeling framework and the PDE toolbox? What is the difference between the two methods. What is the recommended method?
It’d be great if you could provide some insights into these areas. Hi,
I am experimenting with the Flexible body builder app and have some questions regarding the math behind it’s implementation.
StiffnessMatrix: I understand that the stiffness matrix in the output ROM data is calculated from the Young’s modulus and the poison’s ratio. But I want to change this young’s modulus with every run of the simulation without building the flexible body ROM from scratch. For this, I first export the ROM data with E = 1MPa, define the flexible body using the exported ROM data in simscape, and multiply the stiffness matrix with E_flex which is the variable I want to change with every simulation run.
This is because K = EA/L and since E is a scalar, it can be scaled up or down with just a simple scalar multiplication.
I did some experimentation of this usage by exporting stiffness matrices for E = 1MPa, 2MPa,…etc and I can verify that
det ([StiffnessMat.2MPa]-2*[StiffnessMat.1MPa]) = 0
It would be great if you could verify this usage.
Number of Fixed-Interface Normal Modes: What is the optimal number of frequency modes to retain for a given geometry? It would depend on the geometry and the loading conditions themselves. Is there a way to assess what’s a good estimate for this?
Algorithm for model Generation: Is there a quantitative difference between the included integro-differential modeling framework and the PDE toolbox? What is the difference between the two methods. What is the recommended method?
It’d be great if you could provide some insights into these areas. flexible body, flexible body model builder, craig bampton, reduced order modeling, rom MATLAB Answers — New Questions