Tag Archives: matlab
functionSignatures.json : specify filepath
I like the idea of Matlab function signatures.
How can I specify the file path to search in?
For example, I have a function LoadInputFile , and I want this to default to the directory C://Folder1/Folder2/Folder3, how do I do so? Can I do so both absolute and relative paths?
I have tried a lot of different attempts, all unfortunately failed.
keywords type / basePath , both failed
absolute, relative paths
forward or backward slashes
single or double slashes
Thank you
https://www.mathworks.com/help/matlab/matlab_prog/customize-code-suggestions-and-completions.html
"LoadInputFile": {
"_description": "Load a text input file",
"inputs": [
{
"name": "filename",
"kind": "optional",
"type": "filepath=Folder2/Folder3/*.txt",
"basePath": "C://Folder1/Folder2/Folder3/",
"purpose": "some file is now loaded"
}
]
},I like the idea of Matlab function signatures.
How can I specify the file path to search in?
For example, I have a function LoadInputFile , and I want this to default to the directory C://Folder1/Folder2/Folder3, how do I do so? Can I do so both absolute and relative paths?
I have tried a lot of different attempts, all unfortunately failed.
keywords type / basePath , both failed
absolute, relative paths
forward or backward slashes
single or double slashes
Thank you
https://www.mathworks.com/help/matlab/matlab_prog/customize-code-suggestions-and-completions.html
"LoadInputFile": {
"_description": "Load a text input file",
"inputs": [
{
"name": "filename",
"kind": "optional",
"type": "filepath=Folder2/Folder3/*.txt",
"basePath": "C://Folder1/Folder2/Folder3/",
"purpose": "some file is now loaded"
}
]
}, I like the idea of Matlab function signatures.
How can I specify the file path to search in?
For example, I have a function LoadInputFile , and I want this to default to the directory C://Folder1/Folder2/Folder3, how do I do so? Can I do so both absolute and relative paths?
I have tried a lot of different attempts, all unfortunately failed.
keywords type / basePath , both failed
absolute, relative paths
forward or backward slashes
single or double slashes
Thank you
https://www.mathworks.com/help/matlab/matlab_prog/customize-code-suggestions-and-completions.html
"LoadInputFile": {
"_description": "Load a text input file",
"inputs": [
{
"name": "filename",
"kind": "optional",
"type": "filepath=Folder2/Folder3/*.txt",
"basePath": "C://Folder1/Folder2/Folder3/",
"purpose": "some file is now loaded"
}
]
}, matlab, signature, functionsignatures MATLAB Answers — New Questions
CONVERT FREQUENCY DOMAIN DATA TO TIME DOMAIIN
i have .csv file which contains frequency (Hz), magnitude(dB), phase(degrees). these data are range from 20hz to 2000000Hz(2MHz) and these are non uniformly spaced. i want to convert these data in time domain. i have done ifft code for that. is it correct ?
% Load CSV data
data = readmatrix(filenames{file_idx});
% Extract columns (adjust indices if your CSV has different column order)
freq = data(:, 1); % Frequency in Hz
mag_dB = data(:, 2); % Magnitude in dB
phase_deg = data(:, 3); % Phase in degrees
% Convert to linear magnitude and radians
mag_linear = 10.^(mag_dB/20);
phase_rad = deg2rad(phase_deg);
% Store original data
results{file_idx}.freq_orig = freq;
results{file_idx}.mag_dB_orig = mag_dB;
results{file_idx}.phase_deg_orig = phase_deg;
% Determine frequency range
f_min = min(freq);
f_max = max(freq);
% Use power of 2 for efficient FFT
N_fft = 2^nextpow2(length(freq) * 8);
% Calculate number of positive frequency bins
n_pos = floor(N_fft/2) + 1;
% Create frequency vector for FFT bins
freq_fft_positive = linspace(f_min, f_max, n_pos);
% Interpolate magnitude and phase
mag_fft = interp1(freq, mag_linear, freq_fft_positive, ‘pchip’, ‘extrap’);
phase_fft = interp1(freq, (phase_rad), freq_fft_positive, ‘pchip’, ‘extrap’);
H_fft_pos = mag_fft .* exp(1j * phase_fft);
% Initialize full spectrum
H_full = zeros(1, N_fft);
% Place positive frequencies (DC to Nyquist)
H_full(1:n_pos) = H_fft_pos;
% Mirror for negative frequencies (conjugate symmetry)
if mod(N_fft, 2) == 0
H_full(n_pos+1:N_fft) = conj(H_fft_pos(end-1:-1:2));
else
H_full(n_pos+1:N_fft) = conj(H_fft_pos(end:-1:2));
end
% Perform IFFT
h_time = ifft(H_full, ‘symmetric’);
% Create time vector
fs = 2 * f_max;
dt = 1 / fs;
t = (0:N_fft-1) * dt;i have .csv file which contains frequency (Hz), magnitude(dB), phase(degrees). these data are range from 20hz to 2000000Hz(2MHz) and these are non uniformly spaced. i want to convert these data in time domain. i have done ifft code for that. is it correct ?
% Load CSV data
data = readmatrix(filenames{file_idx});
% Extract columns (adjust indices if your CSV has different column order)
freq = data(:, 1); % Frequency in Hz
mag_dB = data(:, 2); % Magnitude in dB
phase_deg = data(:, 3); % Phase in degrees
% Convert to linear magnitude and radians
mag_linear = 10.^(mag_dB/20);
phase_rad = deg2rad(phase_deg);
% Store original data
results{file_idx}.freq_orig = freq;
results{file_idx}.mag_dB_orig = mag_dB;
results{file_idx}.phase_deg_orig = phase_deg;
% Determine frequency range
f_min = min(freq);
f_max = max(freq);
% Use power of 2 for efficient FFT
N_fft = 2^nextpow2(length(freq) * 8);
% Calculate number of positive frequency bins
n_pos = floor(N_fft/2) + 1;
% Create frequency vector for FFT bins
freq_fft_positive = linspace(f_min, f_max, n_pos);
% Interpolate magnitude and phase
mag_fft = interp1(freq, mag_linear, freq_fft_positive, ‘pchip’, ‘extrap’);
phase_fft = interp1(freq, (phase_rad), freq_fft_positive, ‘pchip’, ‘extrap’);
H_fft_pos = mag_fft .* exp(1j * phase_fft);
% Initialize full spectrum
H_full = zeros(1, N_fft);
% Place positive frequencies (DC to Nyquist)
H_full(1:n_pos) = H_fft_pos;
% Mirror for negative frequencies (conjugate symmetry)
if mod(N_fft, 2) == 0
H_full(n_pos+1:N_fft) = conj(H_fft_pos(end-1:-1:2));
else
H_full(n_pos+1:N_fft) = conj(H_fft_pos(end:-1:2));
end
% Perform IFFT
h_time = ifft(H_full, ‘symmetric’);
% Create time vector
fs = 2 * f_max;
dt = 1 / fs;
t = (0:N_fft-1) * dt; i have .csv file which contains frequency (Hz), magnitude(dB), phase(degrees). these data are range from 20hz to 2000000Hz(2MHz) and these are non uniformly spaced. i want to convert these data in time domain. i have done ifft code for that. is it correct ?
% Load CSV data
data = readmatrix(filenames{file_idx});
% Extract columns (adjust indices if your CSV has different column order)
freq = data(:, 1); % Frequency in Hz
mag_dB = data(:, 2); % Magnitude in dB
phase_deg = data(:, 3); % Phase in degrees
% Convert to linear magnitude and radians
mag_linear = 10.^(mag_dB/20);
phase_rad = deg2rad(phase_deg);
% Store original data
results{file_idx}.freq_orig = freq;
results{file_idx}.mag_dB_orig = mag_dB;
results{file_idx}.phase_deg_orig = phase_deg;
% Determine frequency range
f_min = min(freq);
f_max = max(freq);
% Use power of 2 for efficient FFT
N_fft = 2^nextpow2(length(freq) * 8);
% Calculate number of positive frequency bins
n_pos = floor(N_fft/2) + 1;
% Create frequency vector for FFT bins
freq_fft_positive = linspace(f_min, f_max, n_pos);
% Interpolate magnitude and phase
mag_fft = interp1(freq, mag_linear, freq_fft_positive, ‘pchip’, ‘extrap’);
phase_fft = interp1(freq, (phase_rad), freq_fft_positive, ‘pchip’, ‘extrap’);
H_fft_pos = mag_fft .* exp(1j * phase_fft);
% Initialize full spectrum
H_full = zeros(1, N_fft);
% Place positive frequencies (DC to Nyquist)
H_full(1:n_pos) = H_fft_pos;
% Mirror for negative frequencies (conjugate symmetry)
if mod(N_fft, 2) == 0
H_full(n_pos+1:N_fft) = conj(H_fft_pos(end-1:-1:2));
else
H_full(n_pos+1:N_fft) = conj(H_fft_pos(end:-1:2));
end
% Perform IFFT
h_time = ifft(H_full, ‘symmetric’);
% Create time vector
fs = 2 * f_max;
dt = 1 / fs;
t = (0:N_fft-1) * dt; ifft MATLAB Answers — New Questions
TextScatter implementation does not expose the indices it chose for display when ‘TextDensityPercentage’ is used
rng(10) % for reproducibility
n=100;
x = randn(n,1);
y = randn(n,1);
seq = (1:n)’;
h=textscatter(x,y,string(seq), …
‘TextDensityPercentage’,20, …
‘DisplayName’,’text’)
I want to know the indexes of the unis which have been displayed by function textscatter from handle h (in this case 1, 4 and 22) or from findall, ancestor, ….
I wanted to use textscatter with geoaxes but it seems it is not supported. Therefore the idea is to project the map on cartesian axes and then retrieve the indexes of displayed units from textscatter with ‘Name’, Value ‘TextDensityPercentage’,20, but I need to know the indexes.
Any other idea is welcome (apart from "implementing my own label-selection rule" which labels points if they are not closer than a threshold) .
Copilot and ChatGPT claim it is not possible but I want to have your opinion.
Thank you in advancerng(10) % for reproducibility
n=100;
x = randn(n,1);
y = randn(n,1);
seq = (1:n)’;
h=textscatter(x,y,string(seq), …
‘TextDensityPercentage’,20, …
‘DisplayName’,’text’)
I want to know the indexes of the unis which have been displayed by function textscatter from handle h (in this case 1, 4 and 22) or from findall, ancestor, ….
I wanted to use textscatter with geoaxes but it seems it is not supported. Therefore the idea is to project the map on cartesian axes and then retrieve the indexes of displayed units from textscatter with ‘Name’, Value ‘TextDensityPercentage’,20, but I need to know the indexes.
Any other idea is welcome (apart from "implementing my own label-selection rule" which labels points if they are not closer than a threshold) .
Copilot and ChatGPT claim it is not possible but I want to have your opinion.
Thank you in advance rng(10) % for reproducibility
n=100;
x = randn(n,1);
y = randn(n,1);
seq = (1:n)’;
h=textscatter(x,y,string(seq), …
‘TextDensityPercentage’,20, …
‘DisplayName’,’text’)
I want to know the indexes of the unis which have been displayed by function textscatter from handle h (in this case 1, 4 and 22) or from findall, ancestor, ….
I wanted to use textscatter with geoaxes but it seems it is not supported. Therefore the idea is to project the map on cartesian axes and then retrieve the indexes of displayed units from textscatter with ‘Name’, Value ‘TextDensityPercentage’,20, but I need to know the indexes.
Any other idea is welcome (apart from "implementing my own label-selection rule" which labels points if they are not closer than a threshold) .
Copilot and ChatGPT claim it is not possible but I want to have your opinion.
Thank you in advance textscatter MATLAB Answers — New Questions
How adjust efficiency of chain drive block
How to adjust efficiency of a chain drive block and how to test it.How to adjust efficiency of a chain drive block and how to test it. How to adjust efficiency of a chain drive block and how to test it. simulink, simscape, simscape driveline, multibody MATLAB Answers — New Questions
[aerospace toolbox] Does the satelliteScenario allow to add custom vectors?
I am developing a simple simulator for a university project with the aim of using the sun sensor and a star tracker to perform attitude determination. I am using a method relying on two external reference vectors in the inertial frame and in the body frame, implemented on Simulink and using the aerospace toolbox on Matlab to visualize the satellite. Is it possible to add custom vectors (e.g. in the ECI frame that point to the Sun and to a known star) to the satellite scenario? Do you suggest, as an alternative, to do it in another way?
Thanks in advance.I am developing a simple simulator for a university project with the aim of using the sun sensor and a star tracker to perform attitude determination. I am using a method relying on two external reference vectors in the inertial frame and in the body frame, implemented on Simulink and using the aerospace toolbox on Matlab to visualize the satellite. Is it possible to add custom vectors (e.g. in the ECI frame that point to the Sun and to a known star) to the satellite scenario? Do you suggest, as an alternative, to do it in another way?
Thanks in advance. I am developing a simple simulator for a university project with the aim of using the sun sensor and a star tracker to perform attitude determination. I am using a method relying on two external reference vectors in the inertial frame and in the body frame, implemented on Simulink and using the aerospace toolbox on Matlab to visualize the satellite. Is it possible to add custom vectors (e.g. in the ECI frame that point to the Sun and to a known star) to the satellite scenario? Do you suggest, as an alternative, to do it in another way?
Thanks in advance. vectors, simulink MATLAB Answers — New Questions
How do I add summation to a symbolic equation in order to integrate across set bounds?
The goal is to integrate from a set number to infinity (or some larger number) for function GF-PDF, which is a lognormal distribution with a geometric mean GF (GFg) and spread (sigma). Each GF-PDF is specifically collected for/interpolated to a dry size (Dp) and the other distribution parameters (GFg, sigma) are fit to the data through a data inversion algorithm. For one mode in the distribution, the equation is:
The issue is that sometime there are multiple modes within one GF-PDF and so the equation becomes:
…where for each mode (k), there is a number fraction (f0,k), geometric mean GF (GFg,k), and spread (sigmak) that described each mode and the sum of all the modes is the distribution. The f0, GFg, and sigma are different for all the modes making up the GF-PDF.
The integration I’m trying to do is:
…where I can integrate above a specific value for GFc (that was calculated for a chosen Sc at a chosen Dp) and get the area/fraction of particles above that GFc since the GF-PDF is at unity. I know how to use trapz(), but integration as a whole has been confusing me. From what I have been reading, I need to input the GF-PDF as a symbolic function, but I’m uncertain on how to add the summation to the symbolic equation in the cases where 2 or more modes are present. I could create the single mode equation as a symbolic function, but I’m again not sure how to integrate across the summation of the equations.
Below are functions I created to create the GF-PDFs, but I know that they aren’t symbolic. I add some sample parameters and the range of GF too.
binsp = (exp(1/60)*0.7)-0.7; % logspace for GF range
gf_rng = 0.90:binsp:2.5; % range of GF in log-space for the GF-PDFs
% Example values for a bimodal (k = 2) GF-PDF:
g0s = [1.1,1.5]; % geometric mean GF
sig0s = [1.04,1.05]; % spread in GF
f0s = [0.4,0.6]; % number fraction of mode
% GF-PDF for GF range
gfpdf = GFPDFf(gf_rng,g0s,sig0s,f0s); % uses functions at bottom
% I could make a symbolic function for just the one lognormal mode, I’m not
% sure how to sum them both in it though…
gf_rng = sym(‘gf_rng’);
g0s = sym(‘g0s’);
sig0s = sym(‘sig0s’);
f0s = sym(‘f0s’);
GFPDF_1m = (f0s./sqrt(2.*pi.*(log(sig0s)).^2)).*exp((-0.5).*((log(gf_rng./g0s).^2)./((log(sig0s)).^2)))
% I’m uncertain where to go from here if I want to integrate from GFc to
% infinity for the bimodal curve…
GFc = 1.3; % random GFc value
% Functions for GF-PDF creations
% Calculating the GFPDF:
function npdf = GFPDFf(gf_rng,g0s,sig0s,f0s)
if width(g0s)>1
for i = 1:width(g0s)
pdf(i,:) = lnPDF(gf_rng,g0s(1,i),sig0s(1,i),f0s(1,i));
end
npdf = sum(pdf);
else
npdf = lnPDF(gf_rng,g0s,sig0s,f0s);
end
end
% Plotting Lognormal Modes:
function pdf = lnPDF(gf_rng,g0s,sig0s,f0s)
pdf = (f0s./sqrt(2.*pi.*(log(sig0s)).^2)).*exp((-0.5).*((log(gf_rng./g0s).^2)./((log(sig0s)).^2)));
endThe goal is to integrate from a set number to infinity (or some larger number) for function GF-PDF, which is a lognormal distribution with a geometric mean GF (GFg) and spread (sigma). Each GF-PDF is specifically collected for/interpolated to a dry size (Dp) and the other distribution parameters (GFg, sigma) are fit to the data through a data inversion algorithm. For one mode in the distribution, the equation is:
The issue is that sometime there are multiple modes within one GF-PDF and so the equation becomes:
…where for each mode (k), there is a number fraction (f0,k), geometric mean GF (GFg,k), and spread (sigmak) that described each mode and the sum of all the modes is the distribution. The f0, GFg, and sigma are different for all the modes making up the GF-PDF.
The integration I’m trying to do is:
…where I can integrate above a specific value for GFc (that was calculated for a chosen Sc at a chosen Dp) and get the area/fraction of particles above that GFc since the GF-PDF is at unity. I know how to use trapz(), but integration as a whole has been confusing me. From what I have been reading, I need to input the GF-PDF as a symbolic function, but I’m uncertain on how to add the summation to the symbolic equation in the cases where 2 or more modes are present. I could create the single mode equation as a symbolic function, but I’m again not sure how to integrate across the summation of the equations.
Below are functions I created to create the GF-PDFs, but I know that they aren’t symbolic. I add some sample parameters and the range of GF too.
binsp = (exp(1/60)*0.7)-0.7; % logspace for GF range
gf_rng = 0.90:binsp:2.5; % range of GF in log-space for the GF-PDFs
% Example values for a bimodal (k = 2) GF-PDF:
g0s = [1.1,1.5]; % geometric mean GF
sig0s = [1.04,1.05]; % spread in GF
f0s = [0.4,0.6]; % number fraction of mode
% GF-PDF for GF range
gfpdf = GFPDFf(gf_rng,g0s,sig0s,f0s); % uses functions at bottom
% I could make a symbolic function for just the one lognormal mode, I’m not
% sure how to sum them both in it though…
gf_rng = sym(‘gf_rng’);
g0s = sym(‘g0s’);
sig0s = sym(‘sig0s’);
f0s = sym(‘f0s’);
GFPDF_1m = (f0s./sqrt(2.*pi.*(log(sig0s)).^2)).*exp((-0.5).*((log(gf_rng./g0s).^2)./((log(sig0s)).^2)))
% I’m uncertain where to go from here if I want to integrate from GFc to
% infinity for the bimodal curve…
GFc = 1.3; % random GFc value
% Functions for GF-PDF creations
% Calculating the GFPDF:
function npdf = GFPDFf(gf_rng,g0s,sig0s,f0s)
if width(g0s)>1
for i = 1:width(g0s)
pdf(i,:) = lnPDF(gf_rng,g0s(1,i),sig0s(1,i),f0s(1,i));
end
npdf = sum(pdf);
else
npdf = lnPDF(gf_rng,g0s,sig0s,f0s);
end
end
% Plotting Lognormal Modes:
function pdf = lnPDF(gf_rng,g0s,sig0s,f0s)
pdf = (f0s./sqrt(2.*pi.*(log(sig0s)).^2)).*exp((-0.5).*((log(gf_rng./g0s).^2)./((log(sig0s)).^2)));
end The goal is to integrate from a set number to infinity (or some larger number) for function GF-PDF, which is a lognormal distribution with a geometric mean GF (GFg) and spread (sigma). Each GF-PDF is specifically collected for/interpolated to a dry size (Dp) and the other distribution parameters (GFg, sigma) are fit to the data through a data inversion algorithm. For one mode in the distribution, the equation is:
The issue is that sometime there are multiple modes within one GF-PDF and so the equation becomes:
…where for each mode (k), there is a number fraction (f0,k), geometric mean GF (GFg,k), and spread (sigmak) that described each mode and the sum of all the modes is the distribution. The f0, GFg, and sigma are different for all the modes making up the GF-PDF.
The integration I’m trying to do is:
…where I can integrate above a specific value for GFc (that was calculated for a chosen Sc at a chosen Dp) and get the area/fraction of particles above that GFc since the GF-PDF is at unity. I know how to use trapz(), but integration as a whole has been confusing me. From what I have been reading, I need to input the GF-PDF as a symbolic function, but I’m uncertain on how to add the summation to the symbolic equation in the cases where 2 or more modes are present. I could create the single mode equation as a symbolic function, but I’m again not sure how to integrate across the summation of the equations.
Below are functions I created to create the GF-PDFs, but I know that they aren’t symbolic. I add some sample parameters and the range of GF too.
binsp = (exp(1/60)*0.7)-0.7; % logspace for GF range
gf_rng = 0.90:binsp:2.5; % range of GF in log-space for the GF-PDFs
% Example values for a bimodal (k = 2) GF-PDF:
g0s = [1.1,1.5]; % geometric mean GF
sig0s = [1.04,1.05]; % spread in GF
f0s = [0.4,0.6]; % number fraction of mode
% GF-PDF for GF range
gfpdf = GFPDFf(gf_rng,g0s,sig0s,f0s); % uses functions at bottom
% I could make a symbolic function for just the one lognormal mode, I’m not
% sure how to sum them both in it though…
gf_rng = sym(‘gf_rng’);
g0s = sym(‘g0s’);
sig0s = sym(‘sig0s’);
f0s = sym(‘f0s’);
GFPDF_1m = (f0s./sqrt(2.*pi.*(log(sig0s)).^2)).*exp((-0.5).*((log(gf_rng./g0s).^2)./((log(sig0s)).^2)))
% I’m uncertain where to go from here if I want to integrate from GFc to
% infinity for the bimodal curve…
GFc = 1.3; % random GFc value
% Functions for GF-PDF creations
% Calculating the GFPDF:
function npdf = GFPDFf(gf_rng,g0s,sig0s,f0s)
if width(g0s)>1
for i = 1:width(g0s)
pdf(i,:) = lnPDF(gf_rng,g0s(1,i),sig0s(1,i),f0s(1,i));
end
npdf = sum(pdf);
else
npdf = lnPDF(gf_rng,g0s,sig0s,f0s);
end
end
% Plotting Lognormal Modes:
function pdf = lnPDF(gf_rng,g0s,sig0s,f0s)
pdf = (f0s./sqrt(2.*pi.*(log(sig0s)).^2)).*exp((-0.5).*((log(gf_rng./g0s).^2)./((log(sig0s)).^2)));
end sum, integration, symbolic, pdf MATLAB Answers — New Questions
AUTOSAR Blockset – ERROR: Expected application type to be mapped
I am working on an AUTOSAR architecture using Simulink.
I can compile it without problems, but whenever I perform an action: adding a constant to the dictionary, changing the dimension of a data type or even executing the command
archDict = Simulink.dictionary.archdata.open(‘BmsDataDictionary.sldd’)
I get the error:
The call to autosar_make_rtw_hook, during the after_tlc hook generated the following error:
Expected application type to be mapped
The build process will terminate as a result.
Caused by:
Expected application type to be mapped
I have modified the dictionary in the past, I can’t figure out what is happeningI am working on an AUTOSAR architecture using Simulink.
I can compile it without problems, but whenever I perform an action: adding a constant to the dictionary, changing the dimension of a data type or even executing the command
archDict = Simulink.dictionary.archdata.open(‘BmsDataDictionary.sldd’)
I get the error:
The call to autosar_make_rtw_hook, during the after_tlc hook generated the following error:
Expected application type to be mapped
The build process will terminate as a result.
Caused by:
Expected application type to be mapped
I have modified the dictionary in the past, I can’t figure out what is happening I am working on an AUTOSAR architecture using Simulink.
I can compile it without problems, but whenever I perform an action: adding a constant to the dictionary, changing the dimension of a data type or even executing the command
archDict = Simulink.dictionary.archdata.open(‘BmsDataDictionary.sldd’)
I get the error:
The call to autosar_make_rtw_hook, during the after_tlc hook generated the following error:
Expected application type to be mapped
The build process will terminate as a result.
Caused by:
Expected application type to be mapped
I have modified the dictionary in the past, I can’t figure out what is happening autosar, autosar blockset, simulink, software architecture, composition, dictionary MATLAB Answers — New Questions
launchpadXL F28379D interference between inputs of a same ADC
Hello,
============ Context
I’m using simulink with external mode to pilot a launchpadXL F28379D and I use a lot of ADC readings.
ADC_C is used to measure 2 differencial inputs (C_IN2/IN3 and C_IN4/IN5) <=> These measurements present no issue
ADC_B is used to measure 4 single ended-inputs (B2, B3, B4 and B5)
ADC_A is used to measure 4 single ended-inputs (A2, A3, A4 and A5)
My outputs are DAC-A, DAC-B and ePWM 1,2 and 3.
I’ve shared a model for ease of debugging : "Launchpad_Instanciation.slx".
============ Measurements
For the measurements I have the board by itsef and a DC power supply to test the PINs.
To confirm the proper operation of the ADC I input a voltage between the concerned PIN (+) and the board’s GND (-). The issue appears when I test the measurements done with ADC_A and ADC_B. See "InterferenceBetweenADC.png".
In ADC_A
when I input a voltage in A2, I have a input reading. The issue is that I also have a small reading in A3
when I input a voltage in A3, I have a input reading. The issue is that I also have a small reading in A4
when I input a voltage in A4, I have a input reading. The issue is that I also have a small reading in A5
when I input a voltage in A5, I have a input reading. The issue is that I also have a small reading in A2
In ADC_B I have the same issue
when I input a voltage in B2, I have a input reading. The issue is that I also have a small reading in B3
when I input a voltage in B3, I have a input reading. The issue is that I also have a small reading in B4
when I input a voltage in B4, I have a input reading. The issue is that I also have a small reading in B5
when I input a voltage in B5, I have a input reading. The issue is that I also have a small reading in B2
============ Question
Why does an input voltage on a ADC’s input would impact the "next" input of the same ADC?
I appreciate the time you took to read my issue and any help will be greatly appreciated.
Kind regards,Hello,
============ Context
I’m using simulink with external mode to pilot a launchpadXL F28379D and I use a lot of ADC readings.
ADC_C is used to measure 2 differencial inputs (C_IN2/IN3 and C_IN4/IN5) <=> These measurements present no issue
ADC_B is used to measure 4 single ended-inputs (B2, B3, B4 and B5)
ADC_A is used to measure 4 single ended-inputs (A2, A3, A4 and A5)
My outputs are DAC-A, DAC-B and ePWM 1,2 and 3.
I’ve shared a model for ease of debugging : "Launchpad_Instanciation.slx".
============ Measurements
For the measurements I have the board by itsef and a DC power supply to test the PINs.
To confirm the proper operation of the ADC I input a voltage between the concerned PIN (+) and the board’s GND (-). The issue appears when I test the measurements done with ADC_A and ADC_B. See "InterferenceBetweenADC.png".
In ADC_A
when I input a voltage in A2, I have a input reading. The issue is that I also have a small reading in A3
when I input a voltage in A3, I have a input reading. The issue is that I also have a small reading in A4
when I input a voltage in A4, I have a input reading. The issue is that I also have a small reading in A5
when I input a voltage in A5, I have a input reading. The issue is that I also have a small reading in A2
In ADC_B I have the same issue
when I input a voltage in B2, I have a input reading. The issue is that I also have a small reading in B3
when I input a voltage in B3, I have a input reading. The issue is that I also have a small reading in B4
when I input a voltage in B4, I have a input reading. The issue is that I also have a small reading in B5
when I input a voltage in B5, I have a input reading. The issue is that I also have a small reading in B2
============ Question
Why does an input voltage on a ADC’s input would impact the "next" input of the same ADC?
I appreciate the time you took to read my issue and any help will be greatly appreciated.
Kind regards, Hello,
============ Context
I’m using simulink with external mode to pilot a launchpadXL F28379D and I use a lot of ADC readings.
ADC_C is used to measure 2 differencial inputs (C_IN2/IN3 and C_IN4/IN5) <=> These measurements present no issue
ADC_B is used to measure 4 single ended-inputs (B2, B3, B4 and B5)
ADC_A is used to measure 4 single ended-inputs (A2, A3, A4 and A5)
My outputs are DAC-A, DAC-B and ePWM 1,2 and 3.
I’ve shared a model for ease of debugging : "Launchpad_Instanciation.slx".
============ Measurements
For the measurements I have the board by itsef and a DC power supply to test the PINs.
To confirm the proper operation of the ADC I input a voltage between the concerned PIN (+) and the board’s GND (-). The issue appears when I test the measurements done with ADC_A and ADC_B. See "InterferenceBetweenADC.png".
In ADC_A
when I input a voltage in A2, I have a input reading. The issue is that I also have a small reading in A3
when I input a voltage in A3, I have a input reading. The issue is that I also have a small reading in A4
when I input a voltage in A4, I have a input reading. The issue is that I also have a small reading in A5
when I input a voltage in A5, I have a input reading. The issue is that I also have a small reading in A2
In ADC_B I have the same issue
when I input a voltage in B2, I have a input reading. The issue is that I also have a small reading in B3
when I input a voltage in B3, I have a input reading. The issue is that I also have a small reading in B4
when I input a voltage in B4, I have a input reading. The issue is that I also have a small reading in B5
when I input a voltage in B5, I have a input reading. The issue is that I also have a small reading in B2
============ Question
Why does an input voltage on a ADC’s input would impact the "next" input of the same ADC?
I appreciate the time you took to read my issue and any help will be greatly appreciated.
Kind regards, f28379d, interference, adc inputs MATLAB Answers — New Questions
Producing Clutter IQ for arbitrary Waveform
I was looking at https://www.mathworks.com/help/radar/ug/simulating-radar-returns-from-moving-sea-surfaces.html and saw that the radarTransciever() object has a phased.LinearFMWaveform() object attributed to it. Upon looking at this i realize there are only a few types of waveforms available, and it seems NO custom IQ waveform that can be created into a object like phased.LinearFMWaveform() that i can use to define in the radarTransceiver() object and therefore execute the receive(scene).
Ultimately i need to generate IQ off sea surface, with an arbitrary waveform i have predefined/computed.
Is there a way to define a custom waveform that is compatible with what i am trying to do above? or is there another way to generate IQ clutter return with an arbitrary waveform?I was looking at https://www.mathworks.com/help/radar/ug/simulating-radar-returns-from-moving-sea-surfaces.html and saw that the radarTransciever() object has a phased.LinearFMWaveform() object attributed to it. Upon looking at this i realize there are only a few types of waveforms available, and it seems NO custom IQ waveform that can be created into a object like phased.LinearFMWaveform() that i can use to define in the radarTransceiver() object and therefore execute the receive(scene).
Ultimately i need to generate IQ off sea surface, with an arbitrary waveform i have predefined/computed.
Is there a way to define a custom waveform that is compatible with what i am trying to do above? or is there another way to generate IQ clutter return with an arbitrary waveform? I was looking at https://www.mathworks.com/help/radar/ug/simulating-radar-returns-from-moving-sea-surfaces.html and saw that the radarTransciever() object has a phased.LinearFMWaveform() object attributed to it. Upon looking at this i realize there are only a few types of waveforms available, and it seems NO custom IQ waveform that can be created into a object like phased.LinearFMWaveform() that i can use to define in the radarTransceiver() object and therefore execute the receive(scene).
Ultimately i need to generate IQ off sea surface, with an arbitrary waveform i have predefined/computed.
Is there a way to define a custom waveform that is compatible with what i am trying to do above? or is there another way to generate IQ clutter return with an arbitrary waveform? clutter, seasurface, iq, surfacereflectivity, surfacereflectivitysea MATLAB Answers — New Questions
splitapply does not retain ME stack
When the function that splitapply throws an error, this line number of this error is not include in the output (matlab2024b)
Example:
T=table([1:3]’);
G=findgroups(T);
splitapply(@fun, T, G);
function out = fun(varargin)
ERROR
end
This returns:
Error using splitapply>localsplitandapply (line 196)
Unable to apply the function ‘fun’ to the 1st group of data.
Error in splitapply (line 135)
varargout = localsplitandapply(fun,dataVars,gdiffed,sgnums,gdim,nargout);
Error in templateLoopOverAll (line 231)
splitapply(@fun, T, G);
Caused by:
Unrecognized function or variable ‘ERROR’.
I was expeting that the line number that actually caused that error would be included:
Error in testfile>fun (line 5)
ERROR
Error in testfile (line 3)
fun()
Missing this information makes the debugging of fun very challenging.
How to retrieve this line number?When the function that splitapply throws an error, this line number of this error is not include in the output (matlab2024b)
Example:
T=table([1:3]’);
G=findgroups(T);
splitapply(@fun, T, G);
function out = fun(varargin)
ERROR
end
This returns:
Error using splitapply>localsplitandapply (line 196)
Unable to apply the function ‘fun’ to the 1st group of data.
Error in splitapply (line 135)
varargout = localsplitandapply(fun,dataVars,gdiffed,sgnums,gdim,nargout);
Error in templateLoopOverAll (line 231)
splitapply(@fun, T, G);
Caused by:
Unrecognized function or variable ‘ERROR’.
I was expeting that the line number that actually caused that error would be included:
Error in testfile>fun (line 5)
ERROR
Error in testfile (line 3)
fun()
Missing this information makes the debugging of fun very challenging.
How to retrieve this line number? When the function that splitapply throws an error, this line number of this error is not include in the output (matlab2024b)
Example:
T=table([1:3]’);
G=findgroups(T);
splitapply(@fun, T, G);
function out = fun(varargin)
ERROR
end
This returns:
Error using splitapply>localsplitandapply (line 196)
Unable to apply the function ‘fun’ to the 1st group of data.
Error in splitapply (line 135)
varargout = localsplitandapply(fun,dataVars,gdiffed,sgnums,gdim,nargout);
Error in templateLoopOverAll (line 231)
splitapply(@fun, T, G);
Caused by:
Unrecognized function or variable ‘ERROR’.
I was expeting that the line number that actually caused that error would be included:
Error in testfile>fun (line 5)
ERROR
Error in testfile (line 3)
fun()
Missing this information makes the debugging of fun very challenging.
How to retrieve this line number? matlab internals, error handling MATLAB Answers — New Questions
Resolve this exercice please
Mathlab exerciceMathlab exercice Mathlab exercice matlab, matlab function MATLAB Answers — New Questions
Error in converting 2D Kalman filter to 3D.
I am receiving the following error when attempting to convert a 2D Kalman filter into 3D.
Non-uniform distribution of output to dynamically sized inputs in blocks.
PSA screenshot of error message.I am receiving the following error when attempting to convert a 2D Kalman filter into 3D.
Non-uniform distribution of output to dynamically sized inputs in blocks.
PSA screenshot of error message. I am receiving the following error when attempting to convert a 2D Kalman filter into 3D.
Non-uniform distribution of output to dynamically sized inputs in blocks.
PSA screenshot of error message. simulink MATLAB Answers — New Questions
LSTM encoder-decoder model
I’d like to make LSTM encoder-decoder model with deep learning toolbox, whichbased on this link(this is for making same model with Keras). I’m trying to make the timeseries prediction(seq2seq).
https://machinelearningmastery.com/how-to-develop-lstm-models-for-multi-step-time-series-forecasting-of-household-power-consumption/
However, the corresponded warper layer fucvtions(ex TimeDistributed, RepeatVector) are not found in the deep learnig tool box.
Is there any solutions to make LSTM encoder-decoder model with Matlab.I’d like to make LSTM encoder-decoder model with deep learning toolbox, whichbased on this link(this is for making same model with Keras). I’m trying to make the timeseries prediction(seq2seq).
https://machinelearningmastery.com/how-to-develop-lstm-models-for-multi-step-time-series-forecasting-of-household-power-consumption/
However, the corresponded warper layer fucvtions(ex TimeDistributed, RepeatVector) are not found in the deep learnig tool box.
Is there any solutions to make LSTM encoder-decoder model with Matlab. I’d like to make LSTM encoder-decoder model with deep learning toolbox, whichbased on this link(this is for making same model with Keras). I’m trying to make the timeseries prediction(seq2seq).
https://machinelearningmastery.com/how-to-develop-lstm-models-for-multi-step-time-series-forecasting-of-household-power-consumption/
However, the corresponded warper layer fucvtions(ex TimeDistributed, RepeatVector) are not found in the deep learnig tool box.
Is there any solutions to make LSTM encoder-decoder model with Matlab. deep learning, lstm, encoder-decoder MATLAB Answers — New Questions
An easy way to input song chords into a structure of MATLAB
Hello. I’d like to know the way to enter the name of the song chords into the structure of MATLAB easily.
I do research about the related between chords and a piece of music, and I analyze the chords progression in MATLAB. Howerver, it takes too many time to enter the name of chords by hands like this;
chords = struct( …
‘name’, {}, … % name of chords(ex: ‘Cmaj7’)
‘start_sec’, {}, … % start time[s]
‘end_sec’, {} … % end time[s]
);
N=input(‘the number of chords: ‘);
BPM=input(‘BPM: ‘);
chords(1).start_sec=0;
for i=1:N
fprintf(‘n===== Chord %d =====n’, i);
chords(i).name=input(‘Name: ‘); %”
Start=input(‘Start beat: ‘);
chords(i).start_sec=(60/BPM)*4*(Start-1);
if i >= 2
chords(i-1).end_sec=(60/BPM)*4*(Start-1);
end
end
ends=input(‘End beat: ‘);
chords(N).end_sec=(60/BPM)*4*ends;
save("chords_yoruni.mat","chords");
I am a beginner when it comes to programming, so I don’t have any idea. I would like you to tell me even small things.
Thank you for your helpHello. I’d like to know the way to enter the name of the song chords into the structure of MATLAB easily.
I do research about the related between chords and a piece of music, and I analyze the chords progression in MATLAB. Howerver, it takes too many time to enter the name of chords by hands like this;
chords = struct( …
‘name’, {}, … % name of chords(ex: ‘Cmaj7’)
‘start_sec’, {}, … % start time[s]
‘end_sec’, {} … % end time[s]
);
N=input(‘the number of chords: ‘);
BPM=input(‘BPM: ‘);
chords(1).start_sec=0;
for i=1:N
fprintf(‘n===== Chord %d =====n’, i);
chords(i).name=input(‘Name: ‘); %”
Start=input(‘Start beat: ‘);
chords(i).start_sec=(60/BPM)*4*(Start-1);
if i >= 2
chords(i-1).end_sec=(60/BPM)*4*(Start-1);
end
end
ends=input(‘End beat: ‘);
chords(N).end_sec=(60/BPM)*4*ends;
save("chords_yoruni.mat","chords");
I am a beginner when it comes to programming, so I don’t have any idea. I would like you to tell me even small things.
Thank you for your help Hello. I’d like to know the way to enter the name of the song chords into the structure of MATLAB easily.
I do research about the related between chords and a piece of music, and I analyze the chords progression in MATLAB. Howerver, it takes too many time to enter the name of chords by hands like this;
chords = struct( …
‘name’, {}, … % name of chords(ex: ‘Cmaj7’)
‘start_sec’, {}, … % start time[s]
‘end_sec’, {} … % end time[s]
);
N=input(‘the number of chords: ‘);
BPM=input(‘BPM: ‘);
chords(1).start_sec=0;
for i=1:N
fprintf(‘n===== Chord %d =====n’, i);
chords(i).name=input(‘Name: ‘); %”
Start=input(‘Start beat: ‘);
chords(i).start_sec=(60/BPM)*4*(Start-1);
if i >= 2
chords(i-1).end_sec=(60/BPM)*4*(Start-1);
end
end
ends=input(‘End beat: ‘);
chords(N).end_sec=(60/BPM)*4*ends;
save("chords_yoruni.mat","chords");
I am a beginner when it comes to programming, so I don’t have any idea. I would like you to tell me even small things.
Thank you for your help music, input, chords MATLAB Answers — New Questions
Rules formation method using fuzzy c means clustering method.
I want to know about tool that automatically genreate the rules on the basis of dataset with fuzzy c means clustering method .Please explain with any dataset to generate rules automatically .It is very urgent for my study .I want to know about tool that automatically genreate the rules on the basis of dataset with fuzzy c means clustering method .Please explain with any dataset to generate rules automatically .It is very urgent for my study . I want to know about tool that automatically genreate the rules on the basis of dataset with fuzzy c means clustering method .Please explain with any dataset to generate rules automatically .It is very urgent for my study . fcm, fuzzy, mamdani, fis MATLAB Answers — New Questions
Matlab appdesigner – unused (noexistent) “_Label” public properties remain – how to remove them?
Dear community,
In my appdesigner application I have removed / renamed components, but some of their (already renamed/removed) public "_Label" properties (i.e. grayed) remain, although they are not referenced anymore.
Is there any way to "cleanup" the code, or to manually remove them?
Thank you in advance!Dear community,
In my appdesigner application I have removed / renamed components, but some of their (already renamed/removed) public "_Label" properties (i.e. grayed) remain, although they are not referenced anymore.
Is there any way to "cleanup" the code, or to manually remove them?
Thank you in advance! Dear community,
In my appdesigner application I have removed / renamed components, but some of their (already renamed/removed) public "_Label" properties (i.e. grayed) remain, although they are not referenced anymore.
Is there any way to "cleanup" the code, or to manually remove them?
Thank you in advance! matlab appdesigner public properties MATLAB Answers — New Questions
How to install Matlab R2025B on WSL Ubuntu
I have downloaded the matlab_R2025b_Linux zipped file from MATLABS and unzipped it in WSL. However, when I try to run ./install or sudo ./install, nothing happens. There was no GUI pop up for the installation.
Following the instructions from the Installation Help pdf did not help either.I have downloaded the matlab_R2025b_Linux zipped file from MATLABS and unzipped it in WSL. However, when I try to run ./install or sudo ./install, nothing happens. There was no GUI pop up for the installation.
Following the instructions from the Installation Help pdf did not help either. I have downloaded the matlab_R2025b_Linux zipped file from MATLABS and unzipped it in WSL. However, when I try to run ./install or sudo ./install, nothing happens. There was no GUI pop up for the installation.
Following the instructions from the Installation Help pdf did not help either. matlab MATLAB Answers — New Questions
How to check that a matlab.ui.Figure handle is deleted?
There is a waitbar() in my application that shows the progress of a simulation. When an error in the simulation occurs, or when I debug the application, the waitbar windows stay on screen and I have to delete them manually.
I installed a cleanup with
fwaitbar = waitbar(0,’Running simulation of ‘+toml(cname)+’…’);
cleanup = onCleanup(@()killwaitbar(fwaitbar));
…
function killwaitbar(f)
close(f);
end
However, in case there in no error, MATLAB still runs killwaitbar(), and I get the error
Error using close
Invalid figure handle.
Error in R_nests>killwaitbar (line 431)
close(f);
Error in R_nests>@()killwaitbar(fwaitbar) (line 73)
cleanup = onCleanup(@()killwaitbar(fwaitbar));
Error in onCleanup/delete (line 25)
obj.task();
Error in R_nests (line 153)
end
In workspace belonging to R_nests>killwaitbar (line 431)
How can I test for this in the callback? ‘f’ is of class matlab.ui.Figure, but isa(f,’matlab.ui.Figure’) does not say anything about being deleted.
I am sure there is better way to do this but can’t find it.There is a waitbar() in my application that shows the progress of a simulation. When an error in the simulation occurs, or when I debug the application, the waitbar windows stay on screen and I have to delete them manually.
I installed a cleanup with
fwaitbar = waitbar(0,’Running simulation of ‘+toml(cname)+’…’);
cleanup = onCleanup(@()killwaitbar(fwaitbar));
…
function killwaitbar(f)
close(f);
end
However, in case there in no error, MATLAB still runs killwaitbar(), and I get the error
Error using close
Invalid figure handle.
Error in R_nests>killwaitbar (line 431)
close(f);
Error in R_nests>@()killwaitbar(fwaitbar) (line 73)
cleanup = onCleanup(@()killwaitbar(fwaitbar));
Error in onCleanup/delete (line 25)
obj.task();
Error in R_nests (line 153)
end
In workspace belonging to R_nests>killwaitbar (line 431)
How can I test for this in the callback? ‘f’ is of class matlab.ui.Figure, but isa(f,’matlab.ui.Figure’) does not say anything about being deleted.
I am sure there is better way to do this but can’t find it. There is a waitbar() in my application that shows the progress of a simulation. When an error in the simulation occurs, or when I debug the application, the waitbar windows stay on screen and I have to delete them manually.
I installed a cleanup with
fwaitbar = waitbar(0,’Running simulation of ‘+toml(cname)+’…’);
cleanup = onCleanup(@()killwaitbar(fwaitbar));
…
function killwaitbar(f)
close(f);
end
However, in case there in no error, MATLAB still runs killwaitbar(), and I get the error
Error using close
Invalid figure handle.
Error in R_nests>killwaitbar (line 431)
close(f);
Error in R_nests>@()killwaitbar(fwaitbar) (line 73)
cleanup = onCleanup(@()killwaitbar(fwaitbar));
Error in onCleanup/delete (line 25)
obj.task();
Error in R_nests (line 153)
end
In workspace belonging to R_nests>killwaitbar (line 431)
How can I test for this in the callback? ‘f’ is of class matlab.ui.Figure, but isa(f,’matlab.ui.Figure’) does not say anything about being deleted.
I am sure there is better way to do this but can’t find it. waitbar, gui, cleanup, matlab.ui.figure MATLAB Answers — New Questions
Variables Window unusable in Matlab 2025
Unfortunately, the switch to MATLAB 2025 has made the Variable Editor unusable. This is due to two issues:
Variables are not displayed immediately in the Variable Editor. When double-clicking a variable in the workspace, sometimes one and sometimes two windows open—one of which is always empty and shows a loading circle.
When using copy-paste, entire rows or columns are no longer copied. Instead, only a portion is copied, which changes simply by scrolling within the Variable Editor.
As a result, I can no longer use MATLAB effectively, since I frequently need to copy and move large sets of measurement data.
Is this a known issue, or is my PC simply too old/slow/faulty?
Best regards,
JanUnfortunately, the switch to MATLAB 2025 has made the Variable Editor unusable. This is due to two issues:
Variables are not displayed immediately in the Variable Editor. When double-clicking a variable in the workspace, sometimes one and sometimes two windows open—one of which is always empty and shows a loading circle.
When using copy-paste, entire rows or columns are no longer copied. Instead, only a portion is copied, which changes simply by scrolling within the Variable Editor.
As a result, I can no longer use MATLAB effectively, since I frequently need to copy and move large sets of measurement data.
Is this a known issue, or is my PC simply too old/slow/faulty?
Best regards,
Jan Unfortunately, the switch to MATLAB 2025 has made the Variable Editor unusable. This is due to two issues:
Variables are not displayed immediately in the Variable Editor. When double-clicking a variable in the workspace, sometimes one and sometimes two windows open—one of which is always empty and shows a loading circle.
When using copy-paste, entire rows or columns are no longer copied. Instead, only a portion is copied, which changes simply by scrolling within the Variable Editor.
As a result, I can no longer use MATLAB effectively, since I frequently need to copy and move large sets of measurement data.
Is this a known issue, or is my PC simply too old/slow/faulty?
Best regards,
Jan variables windows, copy-paste, loading circle MATLAB Answers — New Questions
Request to rehost MATLAB network license (1102419) to new server IP
the user, trying to install MATLAB on their lab server’s head node for SLURM usage. The earlier license I received from SERC is not valid as it is locked to a different IP address than what is being used by our server.
The current license is bound to:
HostID (INTERNET): 10.16.4.41
Whereas our lab server’s primary IP address is:
10.10.100.152
Could you please rehost MATLAB network license 1102419 in the MathWorks License Center to this new IP (10.10.100.152) and provide the updated network license file or passcode for R2025b?
We already have MATLAB and the Network License Manager installed on the server; only the rehosted license is required to bring the system online.the user, trying to install MATLAB on their lab server’s head node for SLURM usage. The earlier license I received from SERC is not valid as it is locked to a different IP address than what is being used by our server.
The current license is bound to:
HostID (INTERNET): 10.16.4.41
Whereas our lab server’s primary IP address is:
10.10.100.152
Could you please rehost MATLAB network license 1102419 in the MathWorks License Center to this new IP (10.10.100.152) and provide the updated network license file or passcode for R2025b?
We already have MATLAB and the Network License Manager installed on the server; only the rehosted license is required to bring the system online. the user, trying to install MATLAB on their lab server’s head node for SLURM usage. The earlier license I received from SERC is not valid as it is locked to a different IP address than what is being used by our server.
The current license is bound to:
HostID (INTERNET): 10.16.4.41
Whereas our lab server’s primary IP address is:
10.10.100.152
Could you please rehost MATLAB network license 1102419 in the MathWorks License Center to this new IP (10.10.100.152) and provide the updated network license file or passcode for R2025b?
We already have MATLAB and the Network License Manager installed on the server; only the rehosted license is required to bring the system online. rehost MATLAB Answers — New Questions









