Month: January 2025
Working with Real-Time signals in matlab
I am trying to work with a real time signal witht the DSP Tool box but I am finding difficult to acomplish. I have seen the demos and read the documents related with the DSP Tool box but it doesn’t really seem Matlab can work/process real time signals. My objective was to do a DAC to create a signal, an ADC to read this same signal, process it, and then do another DAC to see the processed signal. I have been able to work out an ADC and a DAC but none of the options available (at least for the 2022a version) are actually real time but trying to simulate it.
I will share the code in case anyone has curiostity, but not only it fails when approaching the frequency too nyquist’s but also seems to have a hard time when the processing is just multiplying by two, can’t imagine what would happen if I modulated the signal…
%============================================================%
%============== Continuous Real Time DAC & ADC===============%
%============================================================%
%========= Processes Data and Displays it Real Time =========%
%========= DisplaySignalV5: More advanced processes ========%
%============================================================%
% REQUIRED: Signal Processing Toolbox & DSP System Toolbox (NI Extension)
clear;
close all;
clc;
% === DAC and ADC === %
% Create DataAcquisition object for NI device
dq = daq("ni");
% Add Analog Output Channels to generate the signal on "ao0" and "ao1"
addoutput(dq, "Dev1", "ao0", "Voltage");
addoutput(dq, "Dev1", "ao1", "Voltage");
ch_out = dq.Channels(1:2);
ch_out(1).Name = "ao0_out";
ch_out(2).Name = "ao1_out";
% Add an Analog Input Channel to acquire the signal on "ai1"
addinput(dq, "Dev1", "ai1", "Voltage");
ch_in = dq.Channels(3);
ch_in.Name = "ai1_in";
% Set the sample rate
rate = 10000; % Hz
dq.Rate = rate;
% Specify the output signal – A square wave with a DC offset
f = 50; % Frequency of 10 Hz
t = (0:rate-1)/rate; % Time vector for 1 second
output = 1.25 + 0.25*square(2*pi*f*t); % Generate square wave with DC offset
% Create timescope to visualize the signals in real time
scope = timescope(‘SampleRate’, rate, ‘TimeSpanSource’, ‘Property’, ‘TimeSpan’, 0.1, …
‘YLimits’, [-2 2], ‘Title’, ‘Output vs Input Signals’, …
‘ShowLegend’, true, ‘ChannelNames’, {‘Inintal Signal DAC_1’, ‘Processed Signal DAC_2’});
% Set the callback function to execute when data is available
batchSize = rate; % Read data for 1 second at a time for more frequent updates
dq.ScansAvailableFcnCount = batchSize;
dq.ScansAvailableFcn = @(src, evt) plotAndWriteSignals(src, output, scope, rate);
% Preload the output data for "ao0"
preloadData = [output’, zeros(length(output), 1)]; % Preload output for ao0, set ao1 to zero initially
preload(dq, preloadData);
% Start the output and input simultaneously in continuous mode
start(dq, "repeatoutput");
% Stop the generation and acquisition after key press
disp(‘Press any key to stop the continuous generation and acquisition.’);
pause();
stop(dq);
disp("Generation and acquisition stopped.");
% Callback function to read data, plot input and output using timescope, and write to ao1 in real-time
function plotAndWriteSignals(src, output, scope, rate)
% Read available data in chunks as defined by ScansAvailableFcnCount
[data, ~] = read(src, src.ScansAvailableFcnCount, "OutputFormat", "Matrix");
processedSignal = 2.*data;
% Ensure that both ‘data’ and ‘outputToPlot’ are column vectors and have the same length
len = length(processedSignal);
outputToPlot = output(1:len)’;
if isrow(processedSignal)
processedSignal = processedSignal’;
end
% Update the timescope with the output and input signals
% The input data and output data must have consistent row sizes
scope([outputToPlot, processedSignal]);
% Write the acquired input data to the output channel "ao1"
% Create a matrix where each row contains values for both output channels
outputData = [outputToPlot, processedSignal]; % First column for ao0, second column for ao1
write(src, outputData);
endI am trying to work with a real time signal witht the DSP Tool box but I am finding difficult to acomplish. I have seen the demos and read the documents related with the DSP Tool box but it doesn’t really seem Matlab can work/process real time signals. My objective was to do a DAC to create a signal, an ADC to read this same signal, process it, and then do another DAC to see the processed signal. I have been able to work out an ADC and a DAC but none of the options available (at least for the 2022a version) are actually real time but trying to simulate it.
I will share the code in case anyone has curiostity, but not only it fails when approaching the frequency too nyquist’s but also seems to have a hard time when the processing is just multiplying by two, can’t imagine what would happen if I modulated the signal…
%============================================================%
%============== Continuous Real Time DAC & ADC===============%
%============================================================%
%========= Processes Data and Displays it Real Time =========%
%========= DisplaySignalV5: More advanced processes ========%
%============================================================%
% REQUIRED: Signal Processing Toolbox & DSP System Toolbox (NI Extension)
clear;
close all;
clc;
% === DAC and ADC === %
% Create DataAcquisition object for NI device
dq = daq("ni");
% Add Analog Output Channels to generate the signal on "ao0" and "ao1"
addoutput(dq, "Dev1", "ao0", "Voltage");
addoutput(dq, "Dev1", "ao1", "Voltage");
ch_out = dq.Channels(1:2);
ch_out(1).Name = "ao0_out";
ch_out(2).Name = "ao1_out";
% Add an Analog Input Channel to acquire the signal on "ai1"
addinput(dq, "Dev1", "ai1", "Voltage");
ch_in = dq.Channels(3);
ch_in.Name = "ai1_in";
% Set the sample rate
rate = 10000; % Hz
dq.Rate = rate;
% Specify the output signal – A square wave with a DC offset
f = 50; % Frequency of 10 Hz
t = (0:rate-1)/rate; % Time vector for 1 second
output = 1.25 + 0.25*square(2*pi*f*t); % Generate square wave with DC offset
% Create timescope to visualize the signals in real time
scope = timescope(‘SampleRate’, rate, ‘TimeSpanSource’, ‘Property’, ‘TimeSpan’, 0.1, …
‘YLimits’, [-2 2], ‘Title’, ‘Output vs Input Signals’, …
‘ShowLegend’, true, ‘ChannelNames’, {‘Inintal Signal DAC_1’, ‘Processed Signal DAC_2’});
% Set the callback function to execute when data is available
batchSize = rate; % Read data for 1 second at a time for more frequent updates
dq.ScansAvailableFcnCount = batchSize;
dq.ScansAvailableFcn = @(src, evt) plotAndWriteSignals(src, output, scope, rate);
% Preload the output data for "ao0"
preloadData = [output’, zeros(length(output), 1)]; % Preload output for ao0, set ao1 to zero initially
preload(dq, preloadData);
% Start the output and input simultaneously in continuous mode
start(dq, "repeatoutput");
% Stop the generation and acquisition after key press
disp(‘Press any key to stop the continuous generation and acquisition.’);
pause();
stop(dq);
disp("Generation and acquisition stopped.");
% Callback function to read data, plot input and output using timescope, and write to ao1 in real-time
function plotAndWriteSignals(src, output, scope, rate)
% Read available data in chunks as defined by ScansAvailableFcnCount
[data, ~] = read(src, src.ScansAvailableFcnCount, "OutputFormat", "Matrix");
processedSignal = 2.*data;
% Ensure that both ‘data’ and ‘outputToPlot’ are column vectors and have the same length
len = length(processedSignal);
outputToPlot = output(1:len)’;
if isrow(processedSignal)
processedSignal = processedSignal’;
end
% Update the timescope with the output and input signals
% The input data and output data must have consistent row sizes
scope([outputToPlot, processedSignal]);
% Write the acquired input data to the output channel "ao1"
% Create a matrix where each row contains values for both output channels
outputData = [outputToPlot, processedSignal]; % First column for ao0, second column for ao1
write(src, outputData);
end I am trying to work with a real time signal witht the DSP Tool box but I am finding difficult to acomplish. I have seen the demos and read the documents related with the DSP Tool box but it doesn’t really seem Matlab can work/process real time signals. My objective was to do a DAC to create a signal, an ADC to read this same signal, process it, and then do another DAC to see the processed signal. I have been able to work out an ADC and a DAC but none of the options available (at least for the 2022a version) are actually real time but trying to simulate it.
I will share the code in case anyone has curiostity, but not only it fails when approaching the frequency too nyquist’s but also seems to have a hard time when the processing is just multiplying by two, can’t imagine what would happen if I modulated the signal…
%============================================================%
%============== Continuous Real Time DAC & ADC===============%
%============================================================%
%========= Processes Data and Displays it Real Time =========%
%========= DisplaySignalV5: More advanced processes ========%
%============================================================%
% REQUIRED: Signal Processing Toolbox & DSP System Toolbox (NI Extension)
clear;
close all;
clc;
% === DAC and ADC === %
% Create DataAcquisition object for NI device
dq = daq("ni");
% Add Analog Output Channels to generate the signal on "ao0" and "ao1"
addoutput(dq, "Dev1", "ao0", "Voltage");
addoutput(dq, "Dev1", "ao1", "Voltage");
ch_out = dq.Channels(1:2);
ch_out(1).Name = "ao0_out";
ch_out(2).Name = "ao1_out";
% Add an Analog Input Channel to acquire the signal on "ai1"
addinput(dq, "Dev1", "ai1", "Voltage");
ch_in = dq.Channels(3);
ch_in.Name = "ai1_in";
% Set the sample rate
rate = 10000; % Hz
dq.Rate = rate;
% Specify the output signal – A square wave with a DC offset
f = 50; % Frequency of 10 Hz
t = (0:rate-1)/rate; % Time vector for 1 second
output = 1.25 + 0.25*square(2*pi*f*t); % Generate square wave with DC offset
% Create timescope to visualize the signals in real time
scope = timescope(‘SampleRate’, rate, ‘TimeSpanSource’, ‘Property’, ‘TimeSpan’, 0.1, …
‘YLimits’, [-2 2], ‘Title’, ‘Output vs Input Signals’, …
‘ShowLegend’, true, ‘ChannelNames’, {‘Inintal Signal DAC_1’, ‘Processed Signal DAC_2’});
% Set the callback function to execute when data is available
batchSize = rate; % Read data for 1 second at a time for more frequent updates
dq.ScansAvailableFcnCount = batchSize;
dq.ScansAvailableFcn = @(src, evt) plotAndWriteSignals(src, output, scope, rate);
% Preload the output data for "ao0"
preloadData = [output’, zeros(length(output), 1)]; % Preload output for ao0, set ao1 to zero initially
preload(dq, preloadData);
% Start the output and input simultaneously in continuous mode
start(dq, "repeatoutput");
% Stop the generation and acquisition after key press
disp(‘Press any key to stop the continuous generation and acquisition.’);
pause();
stop(dq);
disp("Generation and acquisition stopped.");
% Callback function to read data, plot input and output using timescope, and write to ao1 in real-time
function plotAndWriteSignals(src, output, scope, rate)
% Read available data in chunks as defined by ScansAvailableFcnCount
[data, ~] = read(src, src.ScansAvailableFcnCount, "OutputFormat", "Matrix");
processedSignal = 2.*data;
% Ensure that both ‘data’ and ‘outputToPlot’ are column vectors and have the same length
len = length(processedSignal);
outputToPlot = output(1:len)’;
if isrow(processedSignal)
processedSignal = processedSignal’;
end
% Update the timescope with the output and input signals
% The input data and output data must have consistent row sizes
scope([outputToPlot, processedSignal]);
% Write the acquired input data to the output channel "ao1"
% Create a matrix where each row contains values for both output channels
outputData = [outputToPlot, processedSignal]; % First column for ao0, second column for ao1
write(src, outputData);
end dsp, signal processing, digital signal processing, ni-daq, analog input, analog output MATLAB Answers — New Questions
Comparing Polyspace BF results from different projects
The way my CI is currently setup is that it creates a new project per branch. What I want is to compare the result of two branches using the polyspace-access export command. I tried downloading the result from one project and uploading it to the other but it failed.The way my CI is currently setup is that it creates a new project per branch. What I want is to compare the result of two branches using the polyspace-access export command. I tried downloading the result from one project and uploading it to the other but it failed. The way my CI is currently setup is that it creates a new project per branch. What I want is to compare the result of two branches using the polyspace-access export command. I tried downloading the result from one project and uploading it to the other but it failed. bugfinder, polyspace_access, polyspace_results MATLAB Answers — New Questions
Where i can find complete list of simulink blocks supported for code generation?
Where i can find complete list of simulink blocks supported for code generation? The list in link below is incomplete as it lists only basic Simulink blocks.
https://www.mathworks.com/matlabcentral/answers/101601-how-can-i-find-out-which-simulink-blocks-are-not-supported-for-code-generation-and-what-data-types-t
Going to Simulink -> Help -> Block Data Types & Code Generation Support -> All Tables also does not answer my question as that table only covers 4 toolboxes (Audio System, Communication, Computer Vision, DSP) and I know for sure that there are other blocks in other toolboxes from which code can be generated and they are not on that list.
Example, Online PID Tuner/Control System Toolbox, Fuzzy Logic Controller/Fuzzy Logic ToolboxWhere i can find complete list of simulink blocks supported for code generation? The list in link below is incomplete as it lists only basic Simulink blocks.
https://www.mathworks.com/matlabcentral/answers/101601-how-can-i-find-out-which-simulink-blocks-are-not-supported-for-code-generation-and-what-data-types-t
Going to Simulink -> Help -> Block Data Types & Code Generation Support -> All Tables also does not answer my question as that table only covers 4 toolboxes (Audio System, Communication, Computer Vision, DSP) and I know for sure that there are other blocks in other toolboxes from which code can be generated and they are not on that list.
Example, Online PID Tuner/Control System Toolbox, Fuzzy Logic Controller/Fuzzy Logic Toolbox Where i can find complete list of simulink blocks supported for code generation? The list in link below is incomplete as it lists only basic Simulink blocks.
https://www.mathworks.com/matlabcentral/answers/101601-how-can-i-find-out-which-simulink-blocks-are-not-supported-for-code-generation-and-what-data-types-t
Going to Simulink -> Help -> Block Data Types & Code Generation Support -> All Tables also does not answer my question as that table only covers 4 toolboxes (Audio System, Communication, Computer Vision, DSP) and I know for sure that there are other blocks in other toolboxes from which code can be generated and they are not on that list.
Example, Online PID Tuner/Control System Toolbox, Fuzzy Logic Controller/Fuzzy Logic Toolbox code generation, simulink, support, blocks MATLAB Answers — New Questions
,Understand DTFT and DFT using MATLAB
I wish to understand the DTFT and DFT using MATLAB.
So I want to write a code which does the following:
plot X1[n]=COS(2*pi*201/1024*n) where n=0 to1023
plot X2[n]=rect(N) where N=1024 i.e. X2[n]=1 for n=0 to 1023; else X2[n]=0
plot multiplication of both i.e. X1(n)*X2(n)
plot magnitude plot of Y1(w)=DTFT of X1(n) for -pi<w<pi
plot magnitude plot of Y2(w)=DTFT of X2(n) for -pi<w<pi
plot convolution of Y1 and Y2 i.e. Z1(w)=Y1(w) ⊗ Y2(w)
plot frequency samples Z1[k] that are values of Z1(w) at w[k]=2*pi*k/N where 0<k<(N-1)
Plz help me with the codeI wish to understand the DTFT and DFT using MATLAB.
So I want to write a code which does the following:
plot X1[n]=COS(2*pi*201/1024*n) where n=0 to1023
plot X2[n]=rect(N) where N=1024 i.e. X2[n]=1 for n=0 to 1023; else X2[n]=0
plot multiplication of both i.e. X1(n)*X2(n)
plot magnitude plot of Y1(w)=DTFT of X1(n) for -pi<w<pi
plot magnitude plot of Y2(w)=DTFT of X2(n) for -pi<w<pi
plot convolution of Y1 and Y2 i.e. Z1(w)=Y1(w) ⊗ Y2(w)
plot frequency samples Z1[k] that are values of Z1(w) at w[k]=2*pi*k/N where 0<k<(N-1)
Plz help me with the code I wish to understand the DTFT and DFT using MATLAB.
So I want to write a code which does the following:
plot X1[n]=COS(2*pi*201/1024*n) where n=0 to1023
plot X2[n]=rect(N) where N=1024 i.e. X2[n]=1 for n=0 to 1023; else X2[n]=0
plot multiplication of both i.e. X1(n)*X2(n)
plot magnitude plot of Y1(w)=DTFT of X1(n) for -pi<w<pi
plot magnitude plot of Y2(w)=DTFT of X2(n) for -pi<w<pi
plot convolution of Y1 and Y2 i.e. Z1(w)=Y1(w) ⊗ Y2(w)
plot frequency samples Z1[k] that are values of Z1(w) at w[k]=2*pi*k/N where 0<k<(N-1)
Plz help me with the code dft, dtft, freqz, fft, matlab code MATLAB Answers — New Questions
How can I export a scenario containing a parkingLot to xml format or OPENSCENARIO to save the map?
As far as I know, TMW has introduced parkingLot to drivingScenario since 2021b, but this type “parkingLot” of scenario export to xml format is not yet supported, how can I do third party map delivery?Can it only be used in matlab for simulation only?As far as I know, TMW has introduced parkingLot to drivingScenario since 2021b, but this type “parkingLot” of scenario export to xml format is not yet supported, how can I do third party map delivery?Can it only be used in matlab for simulation only? As far as I know, TMW has introduced parkingLot to drivingScenario since 2021b, but this type “parkingLot” of scenario export to xml format is not yet supported, how can I do third party map delivery?Can it only be used in matlab for simulation only? openscenario, opendrive, drivingscenario, parkinglot MATLAB Answers — New Questions
Difference results from MOM method with ttρiangle basis function and pulse
Hi
i find the scattering field in cylinder and i use the MOM method with the triangle basis and pulse. The |Es
| are the same when then incoming field are Einc= E0*exp(-j*k0*r*cos(φ)) in MOM pulse and Einc= E0*exp(j*k0*r*cos(φ)) in MOM triangle.
This the pulse current
function [Is] = currentMoM()
% Load parameters
[f, N, ra, k0, Z0, lambda] = parameter();
% Constants
gamma_const = 1.781;
dfpm = 2*pi/N;
Phi0 = (0:N-1) * dfpm;
% Precompute pairwise phase differences
deltaPhi = zeros(N, N); % Initialize deltaPhi matrix
for i = 1:N
for j = 1:N
deltaPhi(i, j) = Phi0(i) – Phi0(j); % Calculate pairwise phase differences
end
end
% Compute distance matrix R (N x N matrix)
R = zeros(N, N); % Initialize R matrix
for i = 1:N
for j = 1:N
R(i, j) = ra * sqrt(2 – 2 * cos(deltaPhi(i, j))); % Compute distance matrix R
end
end
% Coefficients
coeif1 = (Z0 * k0 / 4) * ra * dfpm;
coeif2 = (Z0 / 2) * sin(k0 * ra * dfpm/ 2);
coeif3 = (gamma_const * k0 * ra * dfpm) / 4;
% Compute lmn matrix
lmn = zeros(N, N); % Initialize lmn matrix
for i = 1:N
for j = 1:N
if i==j
lmn(i, j) = coeif1 * (1 – 1i * (2 / pi) * (log(coeif3) – 1)); % Diagonal elements
else
lmn(i, j) = coeif2 * besselh(0, 2, k0 * R(i, j)); % Compute each element of lmn
end
end
zmn = lmn;
end
% Handle diagonal elements separately
% Set zmn equal to lmn
% Compute gm vector using a for loop
gm = zeros(N, 1); % Initialize gm vector
for i = 1:N
gm(i) = E_in_z(Phi0(i)); % Calculate each element of gm using E_in_z function
end
% Solve for currents using linsolve
%Is = linsolve(zmn, gm);
Is = zmn gm;
%Is=linsolve(zmn, gm)
end
and the triangke
function [Is] = currentMoM()
% Parameter initialization
[~, N, ra, k0, Z0, ~] = parameter();
gamma_const = 1.781;
Eps = 1e-9;
dftm =2.*pi./N;
% Precompute constants
B = (4./(Z0 * k0));
A = (gamma_const*k0*ra)./2;
% Initialize matrices and vectors
lmn = zeros(N, N); % (N x N) matrix for lmn
gm = zeros(1, N); % (1 x N) vector for gm
zmn = zeros(N, N); % (N x N) matrix for zmn
% Compute lmn and zmn matrices using nested for-loops
for index_i = 1:N
for index_j = 1:N
% Precompute integration bounds
xi1_i = (index_i – 1) * dftm;
xi2_i = xi1_i + dftm;
xj1_j = (index_j – 1) * dftm;
xj2_j = xj1_j + dftm;
%log(A) +log(abs(x – y) +Eps))
if index_i == index_j
% Diagonal elements
funa = @(x, y) triangle_basisn(x, index_i) .* triangle_basisn(y, index_j) .*ra .* (1 – 1i * (2./pi).*(log(A) +log(abs(x – y) +Eps))) ;
lmn(index_i, index_j) = integral2(funa, xi1_i, xi2_i, xj1_j, xj2_j,’RelTol’, 1e-6, ‘AbsTol’, 1e-6,’Method’,’iterated’);
else
% Off-diagonal elements
funb = @(x, y)triangle_basisn(x, index_i) .* triangle_basisn(y, index_j) .*ra .* besselh(0, 2, k0.*ra.*sqrt(abs(2 – 2 * cos(x – y))) );
lmn(index_i, index_j) = integral2(funb, xi1_i, xi2_i, xj1_j, xj2_j, ‘RelTol’, 1e-6, ‘AbsTol’, 1e-6);
end
% Assign to zmn
zmn(index_i, index_j) = lmn(index_i, index_j);
end
end
% Compute gm vector using a single for-loop
for index_i = 1:N
xi1 = (index_i – 1) * dftm;
xi2 = xi1 + dftm;
func = @(x)B.* triangle_basisn(x, index_i) .* (E_in_z(x));
gm(index_i) = integral(func, xi1, xi2, ‘RelTol’, 1e-6, ‘AbsTol’, 1e-6);
end
% Solve the linear system
epsilon_reg = 1e-10; % Regularization parameter (can be adjusted)
zmn = zmn + epsilon_reg * eye(N); % Add small value to the diagonal
% Solve the linear system
Is = linsolve(zmn, gm’);
end
the scattering field
function z = Escat(r, phi)
% Load parameters
[f, N, ra, k0, Z0, lambda] = parameter();
[Is] = currentMoM(); % Retrieve the current distribution
% Preallocate for final result
FINAL = zeros(size(r)); % Initialize FINAL to the same size as r
dfpulse = 2 * pi / N;
Phi0 = (0:N-1) * dfpulse; % Angle steps (in radians)
coif = (k0 * Z0 / 4); % Coefficient to scale the results
% Create a column vector of Phi0 values
x1 = Phi0(:);
x2 = x1 + dfpulse; % Integration limits (x1, x2)
% Loop to compute the scattered field for each combination of rho and phi
for jj = 1:N
% Ensure phi and r are compatible in size for broadcasting
r_squared = r.^2; % Compute r squared
ra_squared = ra.^2;
% Compute the integrand term
% Define the integrand with the properly dimensioned term
integrand = @(y)besselh(0, 2, k0 * sqrt(r_squared + ra_squared – 2*r.*ra .*cos(phi-y)));
% Perform the numerical integration for each jj
FINAL = FINAL -coif * Is(jj).* ra .* integral(integrand, x1(jj), x2(jj),’ArrayValued’,true);
end
% Return the result
z = FINAL;
end
function z = Escat(r,phi)
[~,N,ra,k0,Z0,~] =parameter();
Is=currentMoM();
%Phi0=zeros(N);
FINAL=0;
A=(k0.*Z0./4);
dftm=2.*pi./N;
%index=1:N
%Phi0=(index-2)*dftm;
Phi0=(0:N-1).*dftm;
x1 = Phi0(:); % Create a column vector of x1 values
x2 = x1 + dftm; % x2 values depend on x1
for jj=1:N
F=@(y)besselh(0,2,k0*sqrt(r.^2 + ra.^2-2.*r.*ra.*cos(phi-y))).* triangle_basisn(y,jj);
% Perform the integral
%pts = optimset(‘TolFun’,1e-6); % Adjust tolerance
%integral_result = integral(integrand, lower_limit, upper_limit, ‘ArrayValued’, true);
integral_result=integral(F,x1(jj),x2(jj),’RelTol’, 1e-6, ‘AbsTol’, 1e-6,’ArrayValued’,false);
% Accumulate the result
FINAL = FINAL-A.*Is(jj).*ra.*integral_result;
end
z=FINAL;
end
function [f,N,ra,k0,Z0,lambda] = parameter()
%UNTITLED Summary of this function goes here
c0=3e8;
Z0=120.*pi;
ra=1;
N=60;
f=300e6;
lambda=c0./f;
k0=2*pi./lambda;
end
and teh triangle basis function
function z = triangle_basisn(phi, k)
% Get number of segments (N) and compute segment width (dftm)
[~, N, ~, ~, ~, ~] = parameter();
df = 2*pi/ N; % Segment width
% Compute the left and right boundaries for the triangle basis
left_bound = (k – 2) * df;
right_bound = (k – 1) * df;
center_bound = k * df;
% Check if phi lies within the support of the triangular basis function
if phi >= left_bound & phi <= right_bound
% Left part of the triangle
z = (phi – left_bound) / df;
elseif phi > right_bound & phi <= center_bound
% Right part of the triangle
z = (center_bound – phi) / df;
else
% Outside the support of the triangle
z = 0;
end
end
function z=E_in_z(phi)
%amplitude
[f,N,ra,k0,Z0] = parameter();
E0=1;
%z=E0.*exp(j.*k0.*ra.*cos(phi)+j.*k0.*ra.*sin(phi));
z=E0.*exp(+j.*k0.*ra.*cos(phi));
end
for the triangle
function z=E_in_z(phi)
%amplitude
[f,N,ra,k0,Z0] = parameter();
E0=1;
%z=E0.*exp(j.*k0.*ra.*cos(phi)+j.*k0.*ra.*sin(phi));
z=E0.*exp(-j.*k0.*ra.*cos(phi));
end
for the pulse
thank you
George
the main script is
clear all
clc
[f,N,ra,k0,Z0,lambda] = parameter();
%ph_i=pi/2;
rho=6*lambda ;
phi=-pi:pi/180:pi;
Es=zeros(size(phi));
phi_d=zeros(size(phi));
%phi=0:pi/200:pi/3
tic
parfor jj=1:length(phi)
Es(jj)=abs(Escat(rho,phi(jj)));
phi_d(jj)=phi(jj).*(180/pi);
end
plot(phi_d,Es,’b–‘,’LineWidth’,2)Hi
i find the scattering field in cylinder and i use the MOM method with the triangle basis and pulse. The |Es
| are the same when then incoming field are Einc= E0*exp(-j*k0*r*cos(φ)) in MOM pulse and Einc= E0*exp(j*k0*r*cos(φ)) in MOM triangle.
This the pulse current
function [Is] = currentMoM()
% Load parameters
[f, N, ra, k0, Z0, lambda] = parameter();
% Constants
gamma_const = 1.781;
dfpm = 2*pi/N;
Phi0 = (0:N-1) * dfpm;
% Precompute pairwise phase differences
deltaPhi = zeros(N, N); % Initialize deltaPhi matrix
for i = 1:N
for j = 1:N
deltaPhi(i, j) = Phi0(i) – Phi0(j); % Calculate pairwise phase differences
end
end
% Compute distance matrix R (N x N matrix)
R = zeros(N, N); % Initialize R matrix
for i = 1:N
for j = 1:N
R(i, j) = ra * sqrt(2 – 2 * cos(deltaPhi(i, j))); % Compute distance matrix R
end
end
% Coefficients
coeif1 = (Z0 * k0 / 4) * ra * dfpm;
coeif2 = (Z0 / 2) * sin(k0 * ra * dfpm/ 2);
coeif3 = (gamma_const * k0 * ra * dfpm) / 4;
% Compute lmn matrix
lmn = zeros(N, N); % Initialize lmn matrix
for i = 1:N
for j = 1:N
if i==j
lmn(i, j) = coeif1 * (1 – 1i * (2 / pi) * (log(coeif3) – 1)); % Diagonal elements
else
lmn(i, j) = coeif2 * besselh(0, 2, k0 * R(i, j)); % Compute each element of lmn
end
end
zmn = lmn;
end
% Handle diagonal elements separately
% Set zmn equal to lmn
% Compute gm vector using a for loop
gm = zeros(N, 1); % Initialize gm vector
for i = 1:N
gm(i) = E_in_z(Phi0(i)); % Calculate each element of gm using E_in_z function
end
% Solve for currents using linsolve
%Is = linsolve(zmn, gm);
Is = zmn gm;
%Is=linsolve(zmn, gm)
end
and the triangke
function [Is] = currentMoM()
% Parameter initialization
[~, N, ra, k0, Z0, ~] = parameter();
gamma_const = 1.781;
Eps = 1e-9;
dftm =2.*pi./N;
% Precompute constants
B = (4./(Z0 * k0));
A = (gamma_const*k0*ra)./2;
% Initialize matrices and vectors
lmn = zeros(N, N); % (N x N) matrix for lmn
gm = zeros(1, N); % (1 x N) vector for gm
zmn = zeros(N, N); % (N x N) matrix for zmn
% Compute lmn and zmn matrices using nested for-loops
for index_i = 1:N
for index_j = 1:N
% Precompute integration bounds
xi1_i = (index_i – 1) * dftm;
xi2_i = xi1_i + dftm;
xj1_j = (index_j – 1) * dftm;
xj2_j = xj1_j + dftm;
%log(A) +log(abs(x – y) +Eps))
if index_i == index_j
% Diagonal elements
funa = @(x, y) triangle_basisn(x, index_i) .* triangle_basisn(y, index_j) .*ra .* (1 – 1i * (2./pi).*(log(A) +log(abs(x – y) +Eps))) ;
lmn(index_i, index_j) = integral2(funa, xi1_i, xi2_i, xj1_j, xj2_j,’RelTol’, 1e-6, ‘AbsTol’, 1e-6,’Method’,’iterated’);
else
% Off-diagonal elements
funb = @(x, y)triangle_basisn(x, index_i) .* triangle_basisn(y, index_j) .*ra .* besselh(0, 2, k0.*ra.*sqrt(abs(2 – 2 * cos(x – y))) );
lmn(index_i, index_j) = integral2(funb, xi1_i, xi2_i, xj1_j, xj2_j, ‘RelTol’, 1e-6, ‘AbsTol’, 1e-6);
end
% Assign to zmn
zmn(index_i, index_j) = lmn(index_i, index_j);
end
end
% Compute gm vector using a single for-loop
for index_i = 1:N
xi1 = (index_i – 1) * dftm;
xi2 = xi1 + dftm;
func = @(x)B.* triangle_basisn(x, index_i) .* (E_in_z(x));
gm(index_i) = integral(func, xi1, xi2, ‘RelTol’, 1e-6, ‘AbsTol’, 1e-6);
end
% Solve the linear system
epsilon_reg = 1e-10; % Regularization parameter (can be adjusted)
zmn = zmn + epsilon_reg * eye(N); % Add small value to the diagonal
% Solve the linear system
Is = linsolve(zmn, gm’);
end
the scattering field
function z = Escat(r, phi)
% Load parameters
[f, N, ra, k0, Z0, lambda] = parameter();
[Is] = currentMoM(); % Retrieve the current distribution
% Preallocate for final result
FINAL = zeros(size(r)); % Initialize FINAL to the same size as r
dfpulse = 2 * pi / N;
Phi0 = (0:N-1) * dfpulse; % Angle steps (in radians)
coif = (k0 * Z0 / 4); % Coefficient to scale the results
% Create a column vector of Phi0 values
x1 = Phi0(:);
x2 = x1 + dfpulse; % Integration limits (x1, x2)
% Loop to compute the scattered field for each combination of rho and phi
for jj = 1:N
% Ensure phi and r are compatible in size for broadcasting
r_squared = r.^2; % Compute r squared
ra_squared = ra.^2;
% Compute the integrand term
% Define the integrand with the properly dimensioned term
integrand = @(y)besselh(0, 2, k0 * sqrt(r_squared + ra_squared – 2*r.*ra .*cos(phi-y)));
% Perform the numerical integration for each jj
FINAL = FINAL -coif * Is(jj).* ra .* integral(integrand, x1(jj), x2(jj),’ArrayValued’,true);
end
% Return the result
z = FINAL;
end
function z = Escat(r,phi)
[~,N,ra,k0,Z0,~] =parameter();
Is=currentMoM();
%Phi0=zeros(N);
FINAL=0;
A=(k0.*Z0./4);
dftm=2.*pi./N;
%index=1:N
%Phi0=(index-2)*dftm;
Phi0=(0:N-1).*dftm;
x1 = Phi0(:); % Create a column vector of x1 values
x2 = x1 + dftm; % x2 values depend on x1
for jj=1:N
F=@(y)besselh(0,2,k0*sqrt(r.^2 + ra.^2-2.*r.*ra.*cos(phi-y))).* triangle_basisn(y,jj);
% Perform the integral
%pts = optimset(‘TolFun’,1e-6); % Adjust tolerance
%integral_result = integral(integrand, lower_limit, upper_limit, ‘ArrayValued’, true);
integral_result=integral(F,x1(jj),x2(jj),’RelTol’, 1e-6, ‘AbsTol’, 1e-6,’ArrayValued’,false);
% Accumulate the result
FINAL = FINAL-A.*Is(jj).*ra.*integral_result;
end
z=FINAL;
end
function [f,N,ra,k0,Z0,lambda] = parameter()
%UNTITLED Summary of this function goes here
c0=3e8;
Z0=120.*pi;
ra=1;
N=60;
f=300e6;
lambda=c0./f;
k0=2*pi./lambda;
end
and teh triangle basis function
function z = triangle_basisn(phi, k)
% Get number of segments (N) and compute segment width (dftm)
[~, N, ~, ~, ~, ~] = parameter();
df = 2*pi/ N; % Segment width
% Compute the left and right boundaries for the triangle basis
left_bound = (k – 2) * df;
right_bound = (k – 1) * df;
center_bound = k * df;
% Check if phi lies within the support of the triangular basis function
if phi >= left_bound & phi <= right_bound
% Left part of the triangle
z = (phi – left_bound) / df;
elseif phi > right_bound & phi <= center_bound
% Right part of the triangle
z = (center_bound – phi) / df;
else
% Outside the support of the triangle
z = 0;
end
end
function z=E_in_z(phi)
%amplitude
[f,N,ra,k0,Z0] = parameter();
E0=1;
%z=E0.*exp(j.*k0.*ra.*cos(phi)+j.*k0.*ra.*sin(phi));
z=E0.*exp(+j.*k0.*ra.*cos(phi));
end
for the triangle
function z=E_in_z(phi)
%amplitude
[f,N,ra,k0,Z0] = parameter();
E0=1;
%z=E0.*exp(j.*k0.*ra.*cos(phi)+j.*k0.*ra.*sin(phi));
z=E0.*exp(-j.*k0.*ra.*cos(phi));
end
for the pulse
thank you
George
the main script is
clear all
clc
[f,N,ra,k0,Z0,lambda] = parameter();
%ph_i=pi/2;
rho=6*lambda ;
phi=-pi:pi/180:pi;
Es=zeros(size(phi));
phi_d=zeros(size(phi));
%phi=0:pi/200:pi/3
tic
parfor jj=1:length(phi)
Es(jj)=abs(Escat(rho,phi(jj)));
phi_d(jj)=phi(jj).*(180/pi);
end
plot(phi_d,Es,’b–‘,’LineWidth’,2) Hi
i find the scattering field in cylinder and i use the MOM method with the triangle basis and pulse. The |Es
| are the same when then incoming field are Einc= E0*exp(-j*k0*r*cos(φ)) in MOM pulse and Einc= E0*exp(j*k0*r*cos(φ)) in MOM triangle.
This the pulse current
function [Is] = currentMoM()
% Load parameters
[f, N, ra, k0, Z0, lambda] = parameter();
% Constants
gamma_const = 1.781;
dfpm = 2*pi/N;
Phi0 = (0:N-1) * dfpm;
% Precompute pairwise phase differences
deltaPhi = zeros(N, N); % Initialize deltaPhi matrix
for i = 1:N
for j = 1:N
deltaPhi(i, j) = Phi0(i) – Phi0(j); % Calculate pairwise phase differences
end
end
% Compute distance matrix R (N x N matrix)
R = zeros(N, N); % Initialize R matrix
for i = 1:N
for j = 1:N
R(i, j) = ra * sqrt(2 – 2 * cos(deltaPhi(i, j))); % Compute distance matrix R
end
end
% Coefficients
coeif1 = (Z0 * k0 / 4) * ra * dfpm;
coeif2 = (Z0 / 2) * sin(k0 * ra * dfpm/ 2);
coeif3 = (gamma_const * k0 * ra * dfpm) / 4;
% Compute lmn matrix
lmn = zeros(N, N); % Initialize lmn matrix
for i = 1:N
for j = 1:N
if i==j
lmn(i, j) = coeif1 * (1 – 1i * (2 / pi) * (log(coeif3) – 1)); % Diagonal elements
else
lmn(i, j) = coeif2 * besselh(0, 2, k0 * R(i, j)); % Compute each element of lmn
end
end
zmn = lmn;
end
% Handle diagonal elements separately
% Set zmn equal to lmn
% Compute gm vector using a for loop
gm = zeros(N, 1); % Initialize gm vector
for i = 1:N
gm(i) = E_in_z(Phi0(i)); % Calculate each element of gm using E_in_z function
end
% Solve for currents using linsolve
%Is = linsolve(zmn, gm);
Is = zmn gm;
%Is=linsolve(zmn, gm)
end
and the triangke
function [Is] = currentMoM()
% Parameter initialization
[~, N, ra, k0, Z0, ~] = parameter();
gamma_const = 1.781;
Eps = 1e-9;
dftm =2.*pi./N;
% Precompute constants
B = (4./(Z0 * k0));
A = (gamma_const*k0*ra)./2;
% Initialize matrices and vectors
lmn = zeros(N, N); % (N x N) matrix for lmn
gm = zeros(1, N); % (1 x N) vector for gm
zmn = zeros(N, N); % (N x N) matrix for zmn
% Compute lmn and zmn matrices using nested for-loops
for index_i = 1:N
for index_j = 1:N
% Precompute integration bounds
xi1_i = (index_i – 1) * dftm;
xi2_i = xi1_i + dftm;
xj1_j = (index_j – 1) * dftm;
xj2_j = xj1_j + dftm;
%log(A) +log(abs(x – y) +Eps))
if index_i == index_j
% Diagonal elements
funa = @(x, y) triangle_basisn(x, index_i) .* triangle_basisn(y, index_j) .*ra .* (1 – 1i * (2./pi).*(log(A) +log(abs(x – y) +Eps))) ;
lmn(index_i, index_j) = integral2(funa, xi1_i, xi2_i, xj1_j, xj2_j,’RelTol’, 1e-6, ‘AbsTol’, 1e-6,’Method’,’iterated’);
else
% Off-diagonal elements
funb = @(x, y)triangle_basisn(x, index_i) .* triangle_basisn(y, index_j) .*ra .* besselh(0, 2, k0.*ra.*sqrt(abs(2 – 2 * cos(x – y))) );
lmn(index_i, index_j) = integral2(funb, xi1_i, xi2_i, xj1_j, xj2_j, ‘RelTol’, 1e-6, ‘AbsTol’, 1e-6);
end
% Assign to zmn
zmn(index_i, index_j) = lmn(index_i, index_j);
end
end
% Compute gm vector using a single for-loop
for index_i = 1:N
xi1 = (index_i – 1) * dftm;
xi2 = xi1 + dftm;
func = @(x)B.* triangle_basisn(x, index_i) .* (E_in_z(x));
gm(index_i) = integral(func, xi1, xi2, ‘RelTol’, 1e-6, ‘AbsTol’, 1e-6);
end
% Solve the linear system
epsilon_reg = 1e-10; % Regularization parameter (can be adjusted)
zmn = zmn + epsilon_reg * eye(N); % Add small value to the diagonal
% Solve the linear system
Is = linsolve(zmn, gm’);
end
the scattering field
function z = Escat(r, phi)
% Load parameters
[f, N, ra, k0, Z0, lambda] = parameter();
[Is] = currentMoM(); % Retrieve the current distribution
% Preallocate for final result
FINAL = zeros(size(r)); % Initialize FINAL to the same size as r
dfpulse = 2 * pi / N;
Phi0 = (0:N-1) * dfpulse; % Angle steps (in radians)
coif = (k0 * Z0 / 4); % Coefficient to scale the results
% Create a column vector of Phi0 values
x1 = Phi0(:);
x2 = x1 + dfpulse; % Integration limits (x1, x2)
% Loop to compute the scattered field for each combination of rho and phi
for jj = 1:N
% Ensure phi and r are compatible in size for broadcasting
r_squared = r.^2; % Compute r squared
ra_squared = ra.^2;
% Compute the integrand term
% Define the integrand with the properly dimensioned term
integrand = @(y)besselh(0, 2, k0 * sqrt(r_squared + ra_squared – 2*r.*ra .*cos(phi-y)));
% Perform the numerical integration for each jj
FINAL = FINAL -coif * Is(jj).* ra .* integral(integrand, x1(jj), x2(jj),’ArrayValued’,true);
end
% Return the result
z = FINAL;
end
function z = Escat(r,phi)
[~,N,ra,k0,Z0,~] =parameter();
Is=currentMoM();
%Phi0=zeros(N);
FINAL=0;
A=(k0.*Z0./4);
dftm=2.*pi./N;
%index=1:N
%Phi0=(index-2)*dftm;
Phi0=(0:N-1).*dftm;
x1 = Phi0(:); % Create a column vector of x1 values
x2 = x1 + dftm; % x2 values depend on x1
for jj=1:N
F=@(y)besselh(0,2,k0*sqrt(r.^2 + ra.^2-2.*r.*ra.*cos(phi-y))).* triangle_basisn(y,jj);
% Perform the integral
%pts = optimset(‘TolFun’,1e-6); % Adjust tolerance
%integral_result = integral(integrand, lower_limit, upper_limit, ‘ArrayValued’, true);
integral_result=integral(F,x1(jj),x2(jj),’RelTol’, 1e-6, ‘AbsTol’, 1e-6,’ArrayValued’,false);
% Accumulate the result
FINAL = FINAL-A.*Is(jj).*ra.*integral_result;
end
z=FINAL;
end
function [f,N,ra,k0,Z0,lambda] = parameter()
%UNTITLED Summary of this function goes here
c0=3e8;
Z0=120.*pi;
ra=1;
N=60;
f=300e6;
lambda=c0./f;
k0=2*pi./lambda;
end
and teh triangle basis function
function z = triangle_basisn(phi, k)
% Get number of segments (N) and compute segment width (dftm)
[~, N, ~, ~, ~, ~] = parameter();
df = 2*pi/ N; % Segment width
% Compute the left and right boundaries for the triangle basis
left_bound = (k – 2) * df;
right_bound = (k – 1) * df;
center_bound = k * df;
% Check if phi lies within the support of the triangular basis function
if phi >= left_bound & phi <= right_bound
% Left part of the triangle
z = (phi – left_bound) / df;
elseif phi > right_bound & phi <= center_bound
% Right part of the triangle
z = (center_bound – phi) / df;
else
% Outside the support of the triangle
z = 0;
end
end
function z=E_in_z(phi)
%amplitude
[f,N,ra,k0,Z0] = parameter();
E0=1;
%z=E0.*exp(j.*k0.*ra.*cos(phi)+j.*k0.*ra.*sin(phi));
z=E0.*exp(+j.*k0.*ra.*cos(phi));
end
for the triangle
function z=E_in_z(phi)
%amplitude
[f,N,ra,k0,Z0] = parameter();
E0=1;
%z=E0.*exp(j.*k0.*ra.*cos(phi)+j.*k0.*ra.*sin(phi));
z=E0.*exp(-j.*k0.*ra.*cos(phi));
end
for the pulse
thank you
George
the main script is
clear all
clc
[f,N,ra,k0,Z0,lambda] = parameter();
%ph_i=pi/2;
rho=6*lambda ;
phi=-pi:pi/180:pi;
Es=zeros(size(phi));
phi_d=zeros(size(phi));
%phi=0:pi/200:pi/3
tic
parfor jj=1:length(phi)
Es(jj)=abs(Escat(rho,phi(jj)));
phi_d(jj)=phi(jj).*(180/pi);
end
plot(phi_d,Es,’b–‘,’LineWidth’,2) mom, matrix, scattering MATLAB Answers — New Questions
What are ways to generate .NET code from Matlab/Simulink?
*I need to share my Matlab codes and algorithms to use for a .NET application. What are the different ways to get this done.*
I know that with the use of Matlab Compiler SDK we can build .NET apps.
Any other way to do so without having Matlab Compiler SDK. I have licenses for Matlab and simulink Coder.
It would be great if we can discuss limitations of the workarounds.*I need to share my Matlab codes and algorithms to use for a .NET application. What are the different ways to get this done.*
I know that with the use of Matlab Compiler SDK we can build .NET apps.
Any other way to do so without having Matlab Compiler SDK. I have licenses for Matlab and simulink Coder.
It would be great if we can discuss limitations of the workarounds. *I need to share my Matlab codes and algorithms to use for a .NET application. What are the different ways to get this done.*
I know that with the use of Matlab Compiler SDK we can build .NET apps.
Any other way to do so without having Matlab Compiler SDK. I have licenses for Matlab and simulink Coder.
It would be great if we can discuss limitations of the workarounds. matlab coder, code generation, .net, java, matlab compiler MATLAB Answers — New Questions
What is the simplest way to transfer my MATLAB settings from linux to windows (specifically: modified keyboard shortcut settings and the path to my library stored in Dropbox)
I do most of my work in Linux but sometime have to use Windows for certain applications. I have MATLAB on both but have only recently wanted to use MATLAB on Windows. What is the simplest method for transferring my settings from Linux to Windows? I have my library of m files stored on Dropbox but I do not actually put every subfolder into the path. I also store my `.matlab/` directory in Dropbox (sync setting between my Linux desktop and laptop) and can see my `EmacsModifiedDefaultSet.xml` file with my keyboard preferences but MATLAB says it cannot import that.
I doubt it would be possible to sync the keyboard shortcuts file but if not, please let me know.I do most of my work in Linux but sometime have to use Windows for certain applications. I have MATLAB on both but have only recently wanted to use MATLAB on Windows. What is the simplest method for transferring my settings from Linux to Windows? I have my library of m files stored on Dropbox but I do not actually put every subfolder into the path. I also store my `.matlab/` directory in Dropbox (sync setting between my Linux desktop and laptop) and can see my `EmacsModifiedDefaultSet.xml` file with my keyboard preferences but MATLAB says it cannot import that.
I doubt it would be possible to sync the keyboard shortcuts file but if not, please let me know. I do most of my work in Linux but sometime have to use Windows for certain applications. I have MATLAB on both but have only recently wanted to use MATLAB on Windows. What is the simplest method for transferring my settings from Linux to Windows? I have my library of m files stored on Dropbox but I do not actually put every subfolder into the path. I also store my `.matlab/` directory in Dropbox (sync setting between my Linux desktop and laptop) and can see my `EmacsModifiedDefaultSet.xml` file with my keyboard preferences but MATLAB says it cannot import that.
I doubt it would be possible to sync the keyboard shortcuts file but if not, please let me know. settings, path, windows, linux, preferences MATLAB Answers — New Questions
plot multiple points in multiple colors
I am trying to plot the peaks and their harmonics. Figure 5 plots the peaks between 0-135 Hz and figure 6 plots the peaks and their harmonics between the normal frequency range i.e. 0-2000 Hz.
The first part of Figure 6 plots normal graph between freq_s(0-2000 Hz) and Signal_fft_hilbert. I want to plot xx2 peaks on this plot. I am not able to draw this plot. I want to mark these points in different colors for each ‘k’.Also I am getting error with regards to size of freq_s and xx2. Can somebody suggest anything?
figure(5)
ind = (freq_s>=0 & freq_s<= 135); %// logical index to select desired range
[peaks, locs] = findpeaks(abs(Signal_fft_hilbert(ind)))
plot(freq_s(locs),abs(Signal_fft_hilbert(locs)))
hold on
plot(freq_s(locs),peaks,’*g’)
for k=1:length(peaks)
z=z+1;
top1{k}=freq_s(locs(k));
for s1=1:length(peaks)
xx{s1}=top1{k}*s1;
end
[xx1]=[xx(:)]
xx2=cell2mat(xx1);
figure(6)
plot(freq_s(2:250),abs(Signal_fft_hilbert(2:250)))
hold on
plot(freq_s,xx2,’*g’)
endI am trying to plot the peaks and their harmonics. Figure 5 plots the peaks between 0-135 Hz and figure 6 plots the peaks and their harmonics between the normal frequency range i.e. 0-2000 Hz.
The first part of Figure 6 plots normal graph between freq_s(0-2000 Hz) and Signal_fft_hilbert. I want to plot xx2 peaks on this plot. I am not able to draw this plot. I want to mark these points in different colors for each ‘k’.Also I am getting error with regards to size of freq_s and xx2. Can somebody suggest anything?
figure(5)
ind = (freq_s>=0 & freq_s<= 135); %// logical index to select desired range
[peaks, locs] = findpeaks(abs(Signal_fft_hilbert(ind)))
plot(freq_s(locs),abs(Signal_fft_hilbert(locs)))
hold on
plot(freq_s(locs),peaks,’*g’)
for k=1:length(peaks)
z=z+1;
top1{k}=freq_s(locs(k));
for s1=1:length(peaks)
xx{s1}=top1{k}*s1;
end
[xx1]=[xx(:)]
xx2=cell2mat(xx1);
figure(6)
plot(freq_s(2:250),abs(Signal_fft_hilbert(2:250)))
hold on
plot(freq_s,xx2,’*g’)
end I am trying to plot the peaks and their harmonics. Figure 5 plots the peaks between 0-135 Hz and figure 6 plots the peaks and their harmonics between the normal frequency range i.e. 0-2000 Hz.
The first part of Figure 6 plots normal graph between freq_s(0-2000 Hz) and Signal_fft_hilbert. I want to plot xx2 peaks on this plot. I am not able to draw this plot. I want to mark these points in different colors for each ‘k’.Also I am getting error with regards to size of freq_s and xx2. Can somebody suggest anything?
figure(5)
ind = (freq_s>=0 & freq_s<= 135); %// logical index to select desired range
[peaks, locs] = findpeaks(abs(Signal_fft_hilbert(ind)))
plot(freq_s(locs),abs(Signal_fft_hilbert(locs)))
hold on
plot(freq_s(locs),peaks,’*g’)
for k=1:length(peaks)
z=z+1;
top1{k}=freq_s(locs(k));
for s1=1:length(peaks)
xx{s1}=top1{k}*s1;
end
[xx1]=[xx(:)]
xx2=cell2mat(xx1);
figure(6)
plot(freq_s(2:250),abs(Signal_fft_hilbert(2:250)))
hold on
plot(freq_s,xx2,’*g’)
end color, multiple, plot MATLAB Answers — New Questions
How to Programmatically Create S-function in Matlab r2023a
Hi,
i would like to know how using m-script we can create the S-function for a top level subsystem.Manually i am able to achive this by right clicking on the subsystem->C/C++ Code->Generate S-function.Any answers related to S-function viw m-script are welcome
Thanks for your support in advance.Hi,
i would like to know how using m-script we can create the S-function for a top level subsystem.Manually i am able to achive this by right clicking on the subsystem->C/C++ Code->Generate S-function.Any answers related to S-function viw m-script are welcome
Thanks for your support in advance. Hi,
i would like to know how using m-script we can create the S-function for a top level subsystem.Manually i am able to achive this by right clicking on the subsystem->C/C++ Code->Generate S-function.Any answers related to S-function viw m-script are welcome
Thanks for your support in advance. s-function MATLAB Answers — New Questions
I want to test if this page has any issues or not
testtest test test MATLAB Answers — New Questions
How do I connect and read data from pixhawk 6x when using simulink/ UAVToolbox?
I am trying to have a play around with simulink and the UAVToolbox but am having issues in simply connecting to the pixhawk.
During the hardware setup for PX4 in simulink, (building firmware, uploading, testing connection etc), I am unable to read accelerometer data, however the odd thing is that I AM able to build and upload the firmware. I am very confused as to why it can connect when uploading, but not when trying to read data. Additionally I dont have this problem when using things such as QGC.
As far as I am aware, the port for uploading is the same as reading (/dev/ttyACM0), regardless of this I have tried various ports and still no connection.
What do I need to do for this to connect and read from my pixhawk?
Note: I am trying to do this with pixhawk 6x as the target to be deployed in to a physical aircraft, NOT SITL or HITL, alot of the examples and tutorials cover only simulated scenarios and they are not helpful in my current situation, so please do not refer me to any of them unless it specifically refers to a connection issue like this, thank you.
System – Ubuntu 20.04
any help would be great,
thanksI am trying to have a play around with simulink and the UAVToolbox but am having issues in simply connecting to the pixhawk.
During the hardware setup for PX4 in simulink, (building firmware, uploading, testing connection etc), I am unable to read accelerometer data, however the odd thing is that I AM able to build and upload the firmware. I am very confused as to why it can connect when uploading, but not when trying to read data. Additionally I dont have this problem when using things such as QGC.
As far as I am aware, the port for uploading is the same as reading (/dev/ttyACM0), regardless of this I have tried various ports and still no connection.
What do I need to do for this to connect and read from my pixhawk?
Note: I am trying to do this with pixhawk 6x as the target to be deployed in to a physical aircraft, NOT SITL or HITL, alot of the examples and tutorials cover only simulated scenarios and they are not helpful in my current situation, so please do not refer me to any of them unless it specifically refers to a connection issue like this, thank you.
System – Ubuntu 20.04
any help would be great,
thanks I am trying to have a play around with simulink and the UAVToolbox but am having issues in simply connecting to the pixhawk.
During the hardware setup for PX4 in simulink, (building firmware, uploading, testing connection etc), I am unable to read accelerometer data, however the odd thing is that I AM able to build and upload the firmware. I am very confused as to why it can connect when uploading, but not when trying to read data. Additionally I dont have this problem when using things such as QGC.
As far as I am aware, the port for uploading is the same as reading (/dev/ttyACM0), regardless of this I have tried various ports and still no connection.
What do I need to do for this to connect and read from my pixhawk?
Note: I am trying to do this with pixhawk 6x as the target to be deployed in to a physical aircraft, NOT SITL or HITL, alot of the examples and tutorials cover only simulated scenarios and they are not helpful in my current situation, so please do not refer me to any of them unless it specifically refers to a connection issue like this, thank you.
System – Ubuntu 20.04
any help would be great,
thanks pixhawk, px4, linux MATLAB Answers — New Questions
Bought new computer. What is procedure to transfer Matlab?
Bought new computer. What is procedure to transfer Matlab? I have Home license.Bought new computer. What is procedure to transfer Matlab? I have Home license. Bought new computer. What is procedure to transfer Matlab? I have Home license. new computer MATLAB Answers — New Questions
I am getting the error message “Device discovery error: input stream error”
I’m using N1 210 rev 4 usrp radio and I want to use it in Matlab environment.
My problem is the following. If I type "findsdru" in Matlab command line, then I get the following result.
———- begin libuhd error message output ———-
Device discovery error: input stream error
———- end libuhd error message output ———-
ans =
Platform: ‘N200/N210/USRP2’
IPAddress: ‘192.168.10.2’
SerialNum: ‘E7R26M7UP’
Status: ‘Success’
It seems the Matlab finds the usrp device well, but I couldn’t figure out why the error message "Device discovery error: input stream error" occurs.
How can I fix this?I’m using N1 210 rev 4 usrp radio and I want to use it in Matlab environment.
My problem is the following. If I type "findsdru" in Matlab command line, then I get the following result.
———- begin libuhd error message output ———-
Device discovery error: input stream error
———- end libuhd error message output ———-
ans =
Platform: ‘N200/N210/USRP2’
IPAddress: ‘192.168.10.2’
SerialNum: ‘E7R26M7UP’
Status: ‘Success’
It seems the Matlab finds the usrp device well, but I couldn’t figure out why the error message "Device discovery error: input stream error" occurs.
How can I fix this? I’m using N1 210 rev 4 usrp radio and I want to use it in Matlab environment.
My problem is the following. If I type "findsdru" in Matlab command line, then I get the following result.
———- begin libuhd error message output ———-
Device discovery error: input stream error
———- end libuhd error message output ———-
ans =
Platform: ‘N200/N210/USRP2’
IPAddress: ‘192.168.10.2’
SerialNum: ‘E7R26M7UP’
Status: ‘Success’
It seems the Matlab finds the usrp device well, but I couldn’t figure out why the error message "Device discovery error: input stream error" occurs.
How can I fix this? usrp, error MATLAB Answers — New Questions
How to get height sensor and ground feedback when UAV Simulink and UE joint simulation
Hello, I’m conducting joint simulation of UAV using MATLAB/Simulink 2023b and UE4.27.
I couldn’t find any sensors related to UAV altitude in Simulink. I want to obtain the height data between the current position of the UAV and the road directly beneath it.
Additionally, I’d like to know if there are any functional modules related to ground feedback during the UAV simulation process.Hello, I’m conducting joint simulation of UAV using MATLAB/Simulink 2023b and UE4.27.
I couldn’t find any sensors related to UAV altitude in Simulink. I want to obtain the height data between the current position of the UAV and the road directly beneath it.
Additionally, I’d like to know if there are any functional modules related to ground feedback during the UAV simulation process. Hello, I’m conducting joint simulation of UAV using MATLAB/Simulink 2023b and UE4.27.
I couldn’t find any sensors related to UAV altitude in Simulink. I want to obtain the height data between the current position of the UAV and the road directly beneath it.
Additionally, I’d like to know if there are any functional modules related to ground feedback during the UAV simulation process. uav MATLAB Answers — New Questions
I am struggling to modify the “Highway lane change” example.
I am trying to implement the "Highway lane change" example with my own controller. Initially I designed my controller such that if I can provide the controller a reference path ( in the form of a N*2 matrix) the controller will be able to follow that path. Now I want to extend my project such that the reference path will be generated autonomously with the help of sensor fusion. I can see the similar thing has been done in the "Highway lane change" project. But for my controller I need to extract the reference X and Y values. But I am struggling to find those 2 values. I have tries with a matlab function block with the following code –
function [X_ref, Y_ref] = extractWaypoints(TrajectoryInfo)
% Extract X and Y waypoints from the planned trajectory
optimalTrajIndex = TrajectoryInfo.OptimalTrajectoryIndex;
trajectory = TrajectoryInfo.GlobalTrajectory(optimalTrajIndex).Trajectory;
% Extract X and Y positions
X_ref = trajectory(:, 1);
Y_ref = trajectory(:, 2);
end
But with this I am getting the error, "Error:’Input Port 1′ of ‘MotionPlanner/Ref_waypoints’ expects a bus but receives a nonbus signal from ‘Output Port 1’ of ‘MotionPlanner/MATLAB Function2’."
I am not sure how to work on this example.I am trying to implement the "Highway lane change" example with my own controller. Initially I designed my controller such that if I can provide the controller a reference path ( in the form of a N*2 matrix) the controller will be able to follow that path. Now I want to extend my project such that the reference path will be generated autonomously with the help of sensor fusion. I can see the similar thing has been done in the "Highway lane change" project. But for my controller I need to extract the reference X and Y values. But I am struggling to find those 2 values. I have tries with a matlab function block with the following code –
function [X_ref, Y_ref] = extractWaypoints(TrajectoryInfo)
% Extract X and Y waypoints from the planned trajectory
optimalTrajIndex = TrajectoryInfo.OptimalTrajectoryIndex;
trajectory = TrajectoryInfo.GlobalTrajectory(optimalTrajIndex).Trajectory;
% Extract X and Y positions
X_ref = trajectory(:, 1);
Y_ref = trajectory(:, 2);
end
But with this I am getting the error, "Error:’Input Port 1′ of ‘MotionPlanner/Ref_waypoints’ expects a bus but receives a nonbus signal from ‘Output Port 1’ of ‘MotionPlanner/MATLAB Function2’."
I am not sure how to work on this example. I am trying to implement the "Highway lane change" example with my own controller. Initially I designed my controller such that if I can provide the controller a reference path ( in the form of a N*2 matrix) the controller will be able to follow that path. Now I want to extend my project such that the reference path will be generated autonomously with the help of sensor fusion. I can see the similar thing has been done in the "Highway lane change" project. But for my controller I need to extract the reference X and Y values. But I am struggling to find those 2 values. I have tries with a matlab function block with the following code –
function [X_ref, Y_ref] = extractWaypoints(TrajectoryInfo)
% Extract X and Y waypoints from the planned trajectory
optimalTrajIndex = TrajectoryInfo.OptimalTrajectoryIndex;
trajectory = TrajectoryInfo.GlobalTrajectory(optimalTrajIndex).Trajectory;
% Extract X and Y positions
X_ref = trajectory(:, 1);
Y_ref = trajectory(:, 2);
end
But with this I am getting the error, "Error:’Input Port 1′ of ‘MotionPlanner/Ref_waypoints’ expects a bus but receives a nonbus signal from ‘Output Port 1’ of ‘MotionPlanner/MATLAB Function2’."
I am not sure how to work on this example. highway lane change controller modification MATLAB Answers — New Questions
Microsoft Describes Top Five SharePoint Features Shipped in 2024
Intrazone Podcast Host Outlines His Top Five SharePoint Features
Mark Kashman, a well-known SharePoint marketing manager and host of the Intrazone podcast, recently published a wrap-up of SharePoint Online for 2024. I’ll leave you to read the full text if you’re interested, but my attention was attracted by two of the topics covered.
Top Five SharePoint Features Shipped in 2024
First, Mark listed his “top five SharePoint and related tech items that shipped in 2024,” namely:
#5: Copilot in OneDrive.
#4: SharePoint Premium.
#3: Microsoft 365 Backup.
#2: Microsoft Lists: New forms experience.
#1: SharePoint agents. I agree that this is the #1 new feature (trivia note: Microsoft recently changed the extension used for agents from .copilot to .agent).
All are worthy advances, but what drew my attention is that four of the five represent opportunities for Microsoft to increase license revenue. Consider the following:
- You can’t use Copilot in OneDrive unless you have a Microsoft 365 Copilot license ($360/user/year).
- SharePoint Premium has a pay-as-you-go (PAYG), so the cost depends on usage of features like eSignature, OCR, document processing models, and translation. It’s easy to accrue quite a bill for functions like document translation, albeit at a much lower cost than doing the work manually.
- Microsoft 365 Backup is also funded on PAYG. My experience is that Microsoft 365 Backup costs are quite reasonable. Some ISVs have integrated the Microsoft Backup API into their own products, so you can choose between the Microsoft implementation and an ISV solution.
- Access to SharePoint agents (Figure 1) are controlled by Microsoft 365 Copilot licenses. However, a trial running between January 6 and June 30, 2025, allows up to 10,000 free SharePoint agent queries per month for unlicensed users. See this page for more details. If you don’t have Microsoft 365 Copilot, you should definitely take advantage of the trial to establish if agents can do a job for your tenant.
If 80% of the top five SharePoint features shipped in 2024 cost tenants extra, it’s fair to ask if Microsoft has lost sight of delighting the Microsoft 365 installed base to chase additional revenues? I think this is true, and it’s driven by two factors: the need to get a return on its investment in AI coupled with a decline in the growth rate for new customers, something that almost became inevitable because of the size of Microsoft 365. I expect the trend to continue in 2025.
Archival of Unlicensed OneDrive for Business Accounts Begins on January 27
One thing that Kashman didn’t mention is Microsoft 365 Archive, a solution that’s about to become a lot more obvious when Microsoft begins the archival of unlicensed OneDrive for Business accounts from January 27, 2025. Tenants will need an Azure subscription linked to a credit card to pay for the storage of unlicensed OneDrive accounts subject to a retention hold (policy, label, or legal hold) and any operations to access data from the unlicensed accounts.
One point to note here is that the retrieval of data from any account automatically means that a tenant must begin to pay for the storage of every archived account. For instance, if a tenant has 100 unlicensed accounts that are in Microsoft 365 Archive and they need to retrieve data from one, they must pay for the storage of all 100 accounts before they can retrieve data from any of the accounts. Unlike the archival of SharePoint Online sites, Microsoft doesn’t offset the fees charged for storage of unlicensed OneDrive accounts against the unused portion of the tenant SharePoint storage quota. The entire consumption amount is billed. $0.05/GB/month mightn’t sound a lot, but it can mount up.
Twenty-Two Local Microsoft Datacenter Regions
The blog also featured the introduction of a new Microsoft 365 cloud region in New Zealand in December 2024 and pointed to similar developments over the last 20 months in Poland (April 2023) Italy (June 2023), Mexico (May 2024), Spain (May 2024), and Taiwan (November 2024). In recent years, Microsoft has steadily built out the collection of in-country cloud regions to make it easier for customers to keep their data at rest within their preferred country using either multi-geo deployments or Advanced Data Residency (ADR).
The difference between the two data residency solutions is that multi-geo deployments can operate at a per-account level (the tenant has a home geography while users can be spread across multiple satellite regions) while ADR focuses on guaranteeing that tenant data for core workloads is stored at rest in a designated region. The core workloads include Exchange Online, SharePoint Online, OneDrive for Business, and Teams.
When Microsoft launched Office 365, the original focus was to serve customers from large regional datacenter deployments like the U.S. and EMEA. That focus gradually changed to deliver services from countries like the United Kingdom, Germany, Japan, India, and France. Microsoft doesn’t say what selection criteria it uses to choose where it deploys local datacenters, but it’s probably a mixture of the demand for cloud services and the desire for data sovereignty within a country. With the addition of New Zealand, there are now 22 county-level regions:
- Australia
- Brazil
- Canada
- France
- Germany
- India
- Israel
- Italy
- Japan
- Mexico
- New Zealand
- Norway
- Poland
- Qatar
- South Africa
- South Korea
- Spain
- Sweden
- Switzerland
- Taiwan
- United Arab Emirates
- United Kingdom.
It’s an impressive list that is likely to grow in 2025.
Top Features Cost Money
Microsoft 365 is a very healthy and successful ecosystem. It helps hundreds of millions of people get their jobs done daily. The level of functionality in some of its applications is staggering and the ingenuity and dedication behind delivering a reliable service across so many datacenters worldwide is commendable. The cost of Microsoft 365 base licenses is reasonable. It’s just a pity that the goodness is tinged by a blunt desire to extract more revenue per user. I guess it’s the way of the future.
Insight like this doesn’t come easily. You’ve got to know the technology and understand how to look behind the scenes. Benefit from the knowledge and experience of the Office 365 for IT Pros team by subscribing to the best eBook covering Office 365 and the wider Microsoft 365 ecosystem.
I have problem using the simulink block obtained from LSTM trained network. The following is the error. number of inputs to be used is 2 and number of ouputs is 1
Error:Layer "sequenceinput": Invalid input data. Invalid size of channel dimension. Layer expects input with channel dimension size 2 but received input with size 1.
Function ‘Subsystem/Stateful Predict/MLFB’ (#218.166.365), line 5, column 19:
"deep.blocks.internal.sequenceNetworkPredict({in_1}, {size(in_1)}, {class(in_1)},"
Errors occurred during parsing of ‘neural_network_deep/Subsystem/Stateful Predict/MLFB’.
Component:MATLAB Function | Category:Coder error
Simulink unable to determine sizes and/or types of the outputs for block ‘neural_network_deep/Subsystem/Stateful Predict/MLFB’ due to errors in the block body, or limitations of the underlying analysis. The errors might be inaccurate. Fix the indicated errors, or explicitly specify sizes and/or types for all block outputs.
Component:MATLAB Function | Category:Coder error
Simulink unable to determine sizes and/or types of the outputs for block ‘neural_network_deep/Subsystem/Stateful Predict/MLFB’ due to errors in the block body, or limitations of the underlying analysis. The errors might be inaccurate. Fix the indicated errors, or explicitly specify sizes and/or types for all block outputs.
Component:Simulink | Category:Model error
Error in port widths or dimensions. ‘Output Port 1’ of ‘neural_network_deep/Subsystem/Stateful Predict/MLFB/in_1’ is a one dimensionalError:Layer "sequenceinput": Invalid input data. Invalid size of channel dimension. Layer expects input with channel dimension size 2 but received input with size 1.
Function ‘Subsystem/Stateful Predict/MLFB’ (#218.166.365), line 5, column 19:
"deep.blocks.internal.sequenceNetworkPredict({in_1}, {size(in_1)}, {class(in_1)},"
Errors occurred during parsing of ‘neural_network_deep/Subsystem/Stateful Predict/MLFB’.
Component:MATLAB Function | Category:Coder error
Simulink unable to determine sizes and/or types of the outputs for block ‘neural_network_deep/Subsystem/Stateful Predict/MLFB’ due to errors in the block body, or limitations of the underlying analysis. The errors might be inaccurate. Fix the indicated errors, or explicitly specify sizes and/or types for all block outputs.
Component:MATLAB Function | Category:Coder error
Simulink unable to determine sizes and/or types of the outputs for block ‘neural_network_deep/Subsystem/Stateful Predict/MLFB’ due to errors in the block body, or limitations of the underlying analysis. The errors might be inaccurate. Fix the indicated errors, or explicitly specify sizes and/or types for all block outputs.
Component:Simulink | Category:Model error
Error in port widths or dimensions. ‘Output Port 1’ of ‘neural_network_deep/Subsystem/Stateful Predict/MLFB/in_1’ is a one dimensional Error:Layer "sequenceinput": Invalid input data. Invalid size of channel dimension. Layer expects input with channel dimension size 2 but received input with size 1.
Function ‘Subsystem/Stateful Predict/MLFB’ (#218.166.365), line 5, column 19:
"deep.blocks.internal.sequenceNetworkPredict({in_1}, {size(in_1)}, {class(in_1)},"
Errors occurred during parsing of ‘neural_network_deep/Subsystem/Stateful Predict/MLFB’.
Component:MATLAB Function | Category:Coder error
Simulink unable to determine sizes and/or types of the outputs for block ‘neural_network_deep/Subsystem/Stateful Predict/MLFB’ due to errors in the block body, or limitations of the underlying analysis. The errors might be inaccurate. Fix the indicated errors, or explicitly specify sizes and/or types for all block outputs.
Component:MATLAB Function | Category:Coder error
Simulink unable to determine sizes and/or types of the outputs for block ‘neural_network_deep/Subsystem/Stateful Predict/MLFB’ due to errors in the block body, or limitations of the underlying analysis. The errors might be inaccurate. Fix the indicated errors, or explicitly specify sizes and/or types for all block outputs.
Component:Simulink | Category:Model error
Error in port widths or dimensions. ‘Output Port 1’ of ‘neural_network_deep/Subsystem/Stateful Predict/MLFB/in_1’ is a one dimensional deep learning, lstm, simulink MATLAB Answers — New Questions
Error using feval and Invalid function name
Please friends, i will aprecciate your help,
I have this code:
function I= Trapecios(f,a,b,n)
%Fórmula Trapecios compuesta
h=(b-a)/n;
x=a:h:b;
x=x(:);
for i=1:n-1
k1=feval(f,x(i));
pesos=[1 2*ones(1,n-1) 1];
I=h./2*sum(pesos*k1);
end
end
So when I input the arguments, issues these messagges:
>> Trapecios(‘x/56’,-56/2,9*56/10,8)
Error using feval
Invalid function name ‘x/56’.
Error in Trapecios (line 7)
k1=feval(f,x(i));Please friends, i will aprecciate your help,
I have this code:
function I= Trapecios(f,a,b,n)
%Fórmula Trapecios compuesta
h=(b-a)/n;
x=a:h:b;
x=x(:);
for i=1:n-1
k1=feval(f,x(i));
pesos=[1 2*ones(1,n-1) 1];
I=h./2*sum(pesos*k1);
end
end
So when I input the arguments, issues these messagges:
>> Trapecios(‘x/56’,-56/2,9*56/10,8)
Error using feval
Invalid function name ‘x/56’.
Error in Trapecios (line 7)
k1=feval(f,x(i)); Please friends, i will aprecciate your help,
I have this code:
function I= Trapecios(f,a,b,n)
%Fórmula Trapecios compuesta
h=(b-a)/n;
x=a:h:b;
x=x(:);
for i=1:n-1
k1=feval(f,x(i));
pesos=[1 2*ones(1,n-1) 1];
I=h./2*sum(pesos*k1);
end
end
So when I input the arguments, issues these messagges:
>> Trapecios(‘x/56’,-56/2,9*56/10,8)
Error using feval
Invalid function name ‘x/56’.
Error in Trapecios (line 7)
k1=feval(f,x(i)); feval, function MATLAB Answers — New Questions
Simulink中生成Autosar代码中如何使得Min Max 生成fminf 或fmaxf 函数 ( How to make Min Max generate fminf or fmaxf functions when generating Autosar code in Simulink)
simulink 生成Autosar 代码中
如何设置Min 或 Max 在生成代码中使用fminf ,fmaxf 函数,
不想使得代码通过if else的方式来实现 Min 或Max
Generating Autosar code using Simulink
How to set Min or Max to use the fminf and fmaxf functions in generating code,
I don’t want the code to implement Min or Max through if else
目前在非Autosar代码中可以实现Min 或Max,但是在Autosar代码中不能实现Min 或Max,
Currently, Min or Max can be implemented in non Autosar code, but it cannot be implemented in Autosar code,simulink 生成Autosar 代码中
如何设置Min 或 Max 在生成代码中使用fminf ,fmaxf 函数,
不想使得代码通过if else的方式来实现 Min 或Max
Generating Autosar code using Simulink
How to set Min or Max to use the fminf and fmaxf functions in generating code,
I don’t want the code to implement Min or Max through if else
目前在非Autosar代码中可以实现Min 或Max,但是在Autosar代码中不能实现Min 或Max,
Currently, Min or Max can be implemented in non Autosar code, but it cannot be implemented in Autosar code, simulink 生成Autosar 代码中
如何设置Min 或 Max 在生成代码中使用fminf ,fmaxf 函数,
不想使得代码通过if else的方式来实现 Min 或Max
Generating Autosar code using Simulink
How to set Min or Max to use the fminf and fmaxf functions in generating code,
I don’t want the code to implement Min or Max through if else
目前在非Autosar代码中可以实现Min 或Max,但是在Autosar代码中不能实现Min 或Max,
Currently, Min or Max can be implemented in non Autosar code, but it cannot be implemented in Autosar code, autosar, fminf, fmaxf, simulink generated autosar code MATLAB Answers — New Questions