Category: Matlab
Category Archives: Matlab
How to change path scenario in Virtual Vehicle Composer?
Hello, I am developing some control logic in Virtual Vehicle Composer (VVC). There are some example scenarios like the one below. However, when I use the "Double lane change" scenario, the steering response is a bit weird (too sudden compared to other simulations such as CarSim). So, I want to know how to change the scenario or manually replace the driver model.
I tried once, but it was difficult to consider the related signals from other vehicles. If anyone has attempted this or if I could get some help regarding this, I would appreciate it.Hello, I am developing some control logic in Virtual Vehicle Composer (VVC). There are some example scenarios like the one below. However, when I use the "Double lane change" scenario, the steering response is a bit weird (too sudden compared to other simulations such as CarSim). So, I want to know how to change the scenario or manually replace the driver model.
I tried once, but it was difficult to consider the related signals from other vehicles. If anyone has attempted this or if I could get some help regarding this, I would appreciate it. Hello, I am developing some control logic in Virtual Vehicle Composer (VVC). There are some example scenarios like the one below. However, when I use the "Double lane change" scenario, the steering response is a bit weird (too sudden compared to other simulations such as CarSim). So, I want to know how to change the scenario or manually replace the driver model.
I tried once, but it was difficult to consider the related signals from other vehicles. If anyone has attempted this or if I could get some help regarding this, I would appreciate it. simulink, virtualvehiclecomposer MATLAB Answers — New Questions
How to fix this error please?
Error using eye
Requested 57660×57660 (24.8GB) array exceeds maximum array size preference. Creation of arrays greater than this limit may take a long time and cause
MATLAB to become unresponsive. See array size limit or preference panel for more information.
Error in Ex11_Bayes_AVO_Inversion (line 79)
Sigma_e = var_e*eye(nt*ntheta); % White noise covarianceError using eye
Requested 57660×57660 (24.8GB) array exceeds maximum array size preference. Creation of arrays greater than this limit may take a long time and cause
MATLAB to become unresponsive. See array size limit or preference panel for more information.
Error in Ex11_Bayes_AVO_Inversion (line 79)
Sigma_e = var_e*eye(nt*ntheta); % White noise covariance Error using eye
Requested 57660×57660 (24.8GB) array exceeds maximum array size preference. Creation of arrays greater than this limit may take a long time and cause
MATLAB to become unresponsive. See array size limit or preference panel for more information.
Error in Ex11_Bayes_AVO_Inversion (line 79)
Sigma_e = var_e*eye(nt*ntheta); % White noise covariance matlab error, error MATLAB Answers — New Questions
How do I extract or call a set of data like PSD(particle size distribution) to Matlab from Aspen Plus using Actxserver without using Excel?
I have been assigned a project which works by linking Aspen Plus with Matlab. What my work is to extract multiple data points to matlab using actx server. For example, I was able to get temperature & pressure data as they are single variable whereas, for Particle Size Distribution(PSD) data it cosists of an array of elements. We have mess sizes & mole fraction of crystals. How do I tell matlab to get that data from Aspen Plus? Please help me with this doubt. Currently using Aspen V12 version.I have been assigned a project which works by linking Aspen Plus with Matlab. What my work is to extract multiple data points to matlab using actx server. For example, I was able to get temperature & pressure data as they are single variable whereas, for Particle Size Distribution(PSD) data it cosists of an array of elements. We have mess sizes & mole fraction of crystals. How do I tell matlab to get that data from Aspen Plus? Please help me with this doubt. Currently using Aspen V12 version. I have been assigned a project which works by linking Aspen Plus with Matlab. What my work is to extract multiple data points to matlab using actx server. For example, I was able to get temperature & pressure data as they are single variable whereas, for Particle Size Distribution(PSD) data it cosists of an array of elements. We have mess sizes & mole fraction of crystals. How do I tell matlab to get that data from Aspen Plus? Please help me with this doubt. Currently using Aspen V12 version. matlab, aspenplus, actxserver MATLAB Answers — New Questions
Average Calculation and Array in For Loop
I collected two data sets. Data 1 collected a data point every 0.01 seconds, while Data 2 collected a data point every 1 min. They were taken at the same time, so they will have the same time stamps.
What I wanted to do was to average all the values of Data 1 for every minute, so that I will end up with the same amount of data points as Data2. I was thinking of using a for loop top iterate through every element of data1. Then, check if the minute of element i is the ssme as the minute of the previous element i-1. If so, I added the two numbers into a variable x and increased the count by count = count + 1. This went one until a new minute was reached. Then, the average of all previous elements (corresponding to the "old" minute) would be calculated by x/count. Then, this value would be appended into a new array called averages. Finally, for the new minute, the sum x would be resetted by x = data1(i) and the count would also be resetted to 1.
The code is attached below. However, when I run it it gives me the error: Error using count. Not enough input arguments. Error in plots_data (line 31): average = x / count; What is wrong?
for i = 1:length(data1)
% Check if the minute of the current data point is the same as the previous one
if i > 1 && m(i) == m(i-1) % m are the minutes
% If it is, accumulate the thrust value and increase the count
x = x + data1(i);
count = count + i;
else
% If it’s a new minute, calculate the average thrust for the previous minute
average = x / count;
averages = [averages; average];
% Reset sum and count for the new minute
x = data1(i);
count = 1;
end
endI collected two data sets. Data 1 collected a data point every 0.01 seconds, while Data 2 collected a data point every 1 min. They were taken at the same time, so they will have the same time stamps.
What I wanted to do was to average all the values of Data 1 for every minute, so that I will end up with the same amount of data points as Data2. I was thinking of using a for loop top iterate through every element of data1. Then, check if the minute of element i is the ssme as the minute of the previous element i-1. If so, I added the two numbers into a variable x and increased the count by count = count + 1. This went one until a new minute was reached. Then, the average of all previous elements (corresponding to the "old" minute) would be calculated by x/count. Then, this value would be appended into a new array called averages. Finally, for the new minute, the sum x would be resetted by x = data1(i) and the count would also be resetted to 1.
The code is attached below. However, when I run it it gives me the error: Error using count. Not enough input arguments. Error in plots_data (line 31): average = x / count; What is wrong?
for i = 1:length(data1)
% Check if the minute of the current data point is the same as the previous one
if i > 1 && m(i) == m(i-1) % m are the minutes
% If it is, accumulate the thrust value and increase the count
x = x + data1(i);
count = count + i;
else
% If it’s a new minute, calculate the average thrust for the previous minute
average = x / count;
averages = [averages; average];
% Reset sum and count for the new minute
x = data1(i);
count = 1;
end
end I collected two data sets. Data 1 collected a data point every 0.01 seconds, while Data 2 collected a data point every 1 min. They were taken at the same time, so they will have the same time stamps.
What I wanted to do was to average all the values of Data 1 for every minute, so that I will end up with the same amount of data points as Data2. I was thinking of using a for loop top iterate through every element of data1. Then, check if the minute of element i is the ssme as the minute of the previous element i-1. If so, I added the two numbers into a variable x and increased the count by count = count + 1. This went one until a new minute was reached. Then, the average of all previous elements (corresponding to the "old" minute) would be calculated by x/count. Then, this value would be appended into a new array called averages. Finally, for the new minute, the sum x would be resetted by x = data1(i) and the count would also be resetted to 1.
The code is attached below. However, when I run it it gives me the error: Error using count. Not enough input arguments. Error in plots_data (line 31): average = x / count; What is wrong?
for i = 1:length(data1)
% Check if the minute of the current data point is the same as the previous one
if i > 1 && m(i) == m(i-1) % m are the minutes
% If it is, accumulate the thrust value and increase the count
x = x + data1(i);
count = count + i;
else
% If it’s a new minute, calculate the average thrust for the previous minute
average = x / count;
averages = [averages; average];
% Reset sum and count for the new minute
x = data1(i);
count = 1;
end
end array MATLAB Answers — New Questions
convert one fixed point format to integer
I have a variable that varies from 0 to 1 and its format is 32 bit fixdt(1,32,30). I want to convert this number 0 to 1 as 0-4095. Help is required for converting fixdt(1,32,30) to 12 bits integer value ranging from 0 to 4095.I have a variable that varies from 0 to 1 and its format is 32 bit fixdt(1,32,30). I want to convert this number 0 to 1 as 0-4095. Help is required for converting fixdt(1,32,30) to 12 bits integer value ranging from 0 to 4095. I have a variable that varies from 0 to 1 and its format is 32 bit fixdt(1,32,30). I want to convert this number 0 to 1 as 0-4095. Help is required for converting fixdt(1,32,30) to 12 bits integer value ranging from 0 to 4095. data type conversion MATLAB Answers — New Questions
How to detect the specific area from an oscilloscope signal
Hello,
I don’t have any experience with MATLAB or coding, therefore I ask you about the general idea and method so that I can solve that easier.
I have two types of patterns, as shown in the attachment, the first type has the unique signal before coming back to the noise level for 0.15-0.2s. While the second one has typically longer time,
Each type has about hundreds files of similar pattern. So how can I create a a program to detect if it is type 1 or type 2 when inserting a random file (.csv format) in 2 groups?Hello,
I don’t have any experience with MATLAB or coding, therefore I ask you about the general idea and method so that I can solve that easier.
I have two types of patterns, as shown in the attachment, the first type has the unique signal before coming back to the noise level for 0.15-0.2s. While the second one has typically longer time,
Each type has about hundreds files of similar pattern. So how can I create a a program to detect if it is type 1 or type 2 when inserting a random file (.csv format) in 2 groups? Hello,
I don’t have any experience with MATLAB or coding, therefore I ask you about the general idea and method so that I can solve that easier.
I have two types of patterns, as shown in the attachment, the first type has the unique signal before coming back to the noise level for 0.15-0.2s. While the second one has typically longer time,
Each type has about hundreds files of similar pattern. So how can I create a a program to detect if it is type 1 or type 2 when inserting a random file (.csv format) in 2 groups? triboelectric, plot, csv MATLAB Answers — New Questions
mex call with fftw_threads causes CRASH AFTER CLOSING MATLAB
strange behavior:
if I work in my matlab source with fft and ifft and then call in the same source my mex-function which works with fftw_threads and of course fftw,ifft, it works very good, but after closing matlab, I’ll get "Segmentation violation detected" with something like fftw_plan_awake….
If I do this process the other way around, first call of my mex function and afterwards fft,ifft in my matlab source, closing matlab, I have no "Segmentation violation detected".
As well, if I run my mex-function without fftw_threads everything is fine!! (irrelevant if I call matlab fft then mex fct or mex fct then matlab fft)
In both source, matlab and c-mex-source, I only make some easy standard fft, nothing special. New is the try to work with fftw_threads.
My Question: what happens in the background so that matlab crashes after closing in some constellations?
Thank you!strange behavior:
if I work in my matlab source with fft and ifft and then call in the same source my mex-function which works with fftw_threads and of course fftw,ifft, it works very good, but after closing matlab, I’ll get "Segmentation violation detected" with something like fftw_plan_awake….
If I do this process the other way around, first call of my mex function and afterwards fft,ifft in my matlab source, closing matlab, I have no "Segmentation violation detected".
As well, if I run my mex-function without fftw_threads everything is fine!! (irrelevant if I call matlab fft then mex fct or mex fct then matlab fft)
In both source, matlab and c-mex-source, I only make some easy standard fft, nothing special. New is the try to work with fftw_threads.
My Question: what happens in the background so that matlab crashes after closing in some constellations?
Thank you! strange behavior:
if I work in my matlab source with fft and ifft and then call in the same source my mex-function which works with fftw_threads and of course fftw,ifft, it works very good, but after closing matlab, I’ll get "Segmentation violation detected" with something like fftw_plan_awake….
If I do this process the other way around, first call of my mex function and afterwards fft,ifft in my matlab source, closing matlab, I have no "Segmentation violation detected".
As well, if I run my mex-function without fftw_threads everything is fine!! (irrelevant if I call matlab fft then mex fct or mex fct then matlab fft)
In both source, matlab and c-mex-source, I only make some easy standard fft, nothing special. New is the try to work with fftw_threads.
My Question: what happens in the background so that matlab crashes after closing in some constellations?
Thank you! mex fftw_threads, crash after closing matlab MATLAB Answers — New Questions
Import data from google sheets to matlab
Hello guys,
I wanted to import data from google sheets to matlab. However I couldn’t find any information about it. Since the google sheets always geting update I can’t just copy and paste so I wanted to import new data for every time I run the matlab script. Is there a way?
Thanks in advance.Hello guys,
I wanted to import data from google sheets to matlab. However I couldn’t find any information about it. Since the google sheets always geting update I can’t just copy and paste so I wanted to import new data for every time I run the matlab script. Is there a way?
Thanks in advance. Hello guys,
I wanted to import data from google sheets to matlab. However I couldn’t find any information about it. Since the google sheets always geting update I can’t just copy and paste so I wanted to import new data for every time I run the matlab script. Is there a way?
Thanks in advance. google sheets MATLAB Answers — New Questions
how to use an integral function inside a for loop? i need to find the value of function that chages as i chages .then using this values i need to find another integral.
r0 =0.1
u =[1:7]’
Q =zeros(length(u),1)
E =zeros(length(Q),1)
for i =1:length(u)
Q(i,1) =0.023*(r0^(-1/4))*((u(i))^(-14/4))
f =@(Q) (Q(i)).^(0.3)
E(i,1) =integral(f,1,7)
endr0 =0.1
u =[1:7]’
Q =zeros(length(u),1)
E =zeros(length(Q),1)
for i =1:length(u)
Q(i,1) =0.023*(r0^(-1/4))*((u(i))^(-14/4))
f =@(Q) (Q(i)).^(0.3)
E(i,1) =integral(f,1,7)
end r0 =0.1
u =[1:7]’
Q =zeros(length(u),1)
E =zeros(length(Q),1)
for i =1:length(u)
Q(i,1) =0.023*(r0^(-1/4))*((u(i))^(-14/4))
f =@(Q) (Q(i)).^(0.3)
E(i,1) =integral(f,1,7)
end integral, for loop MATLAB Answers — New Questions
Error 5001 when trying to run Matlab 2021b.
…on Windows 7 "Unable to communicate with required MathWorks services"…on Windows 7 "Unable to communicate with required MathWorks services" …on Windows 7 "Unable to communicate with required MathWorks services" error, windows7 MATLAB Answers — New Questions
Output comparison of Analog vs Digital mems accelerometer
Analog vs. Digital MEMS Accelerometer Output Comparison
Hello,
We are developing a condition monitoring device and are currently testing its performance using the SPM Vib-15 as a reference, which is a well-known industrial condition monitoring device.
SPM Vib-15 Vibrameter (Analog Device) :
Link to datasheet: Here
Our Device with ST Accelerometer Sensor (IIS3DWB Digital Sensor):
Link to the datasheet: Here
IIS3DWB Configuration :
Accelerometer ODR: IIS3DWB_XL_ODR_26k7Hz
FIFO BDR: IIS3DWB_XL_BATCHED_AT_26k7Hz
Effective ODR: 26.9 kHz
Full Scale: ACCELERO_FS_16
Hardware Filter: IIS3DWB_HP_ODR_DIV_800
Issue :
We are measuring the acceleration RMS and velocity of a compressor/chiller/motor in an industrial setting during normal operation. Despite the IIS3DWB sensor providing output in all three axes, we are considering only the Y-axis, which aligns with the SPM Vib-15.
We have taken readings for acceleration peak, acceleration RMS, and speed RMS using both our device and the SPM Vib-15. However, our device’s readings are significantly different from those of the SPM Vib-15, particularly at higher vibration levels (almost double). The acceleration RMS values have been converted to G to match the units used by the vibrameter, and velocity RMS values are already in mm/s for both devices.
Problem :
Despite similar measurement conditions and proper mounting of both devices, our readings do not match the SPM Vib-15 readings. Given that both devices serve the same application, should we expect the digital sensor data from the IIS3DWB to closely align with the analog sensor output from the SPM Vib-15?
Are we making an error by comparing the outputs of an analog sensor to those of a digital sensor? What could be causing these discrepancies?
We have also attempted linear regression for calibration, but it did not resolve the issue.
Additional Information :
Images:
First from the right side is the SPM vibrameter, and last one (biggest one) is our device.
mounted in vertical direction
mounted in horizontal direction
(in this image at the center is our device)
the third device is for refference (blue one) , which has same sansor that we are using in our device.
Data brief of that device: https://www.st.com/resource/en/data_brief/steval-stwinkt1b.pdfAnalog vs. Digital MEMS Accelerometer Output Comparison
Hello,
We are developing a condition monitoring device and are currently testing its performance using the SPM Vib-15 as a reference, which is a well-known industrial condition monitoring device.
SPM Vib-15 Vibrameter (Analog Device) :
Link to datasheet: Here
Our Device with ST Accelerometer Sensor (IIS3DWB Digital Sensor):
Link to the datasheet: Here
IIS3DWB Configuration :
Accelerometer ODR: IIS3DWB_XL_ODR_26k7Hz
FIFO BDR: IIS3DWB_XL_BATCHED_AT_26k7Hz
Effective ODR: 26.9 kHz
Full Scale: ACCELERO_FS_16
Hardware Filter: IIS3DWB_HP_ODR_DIV_800
Issue :
We are measuring the acceleration RMS and velocity of a compressor/chiller/motor in an industrial setting during normal operation. Despite the IIS3DWB sensor providing output in all three axes, we are considering only the Y-axis, which aligns with the SPM Vib-15.
We have taken readings for acceleration peak, acceleration RMS, and speed RMS using both our device and the SPM Vib-15. However, our device’s readings are significantly different from those of the SPM Vib-15, particularly at higher vibration levels (almost double). The acceleration RMS values have been converted to G to match the units used by the vibrameter, and velocity RMS values are already in mm/s for both devices.
Problem :
Despite similar measurement conditions and proper mounting of both devices, our readings do not match the SPM Vib-15 readings. Given that both devices serve the same application, should we expect the digital sensor data from the IIS3DWB to closely align with the analog sensor output from the SPM Vib-15?
Are we making an error by comparing the outputs of an analog sensor to those of a digital sensor? What could be causing these discrepancies?
We have also attempted linear regression for calibration, but it did not resolve the issue.
Additional Information :
Images:
First from the right side is the SPM vibrameter, and last one (biggest one) is our device.
mounted in vertical direction
mounted in horizontal direction
(in this image at the center is our device)
the third device is for refference (blue one) , which has same sansor that we are using in our device.
Data brief of that device: https://www.st.com/resource/en/data_brief/steval-stwinkt1b.pdf Analog vs. Digital MEMS Accelerometer Output Comparison
Hello,
We are developing a condition monitoring device and are currently testing its performance using the SPM Vib-15 as a reference, which is a well-known industrial condition monitoring device.
SPM Vib-15 Vibrameter (Analog Device) :
Link to datasheet: Here
Our Device with ST Accelerometer Sensor (IIS3DWB Digital Sensor):
Link to the datasheet: Here
IIS3DWB Configuration :
Accelerometer ODR: IIS3DWB_XL_ODR_26k7Hz
FIFO BDR: IIS3DWB_XL_BATCHED_AT_26k7Hz
Effective ODR: 26.9 kHz
Full Scale: ACCELERO_FS_16
Hardware Filter: IIS3DWB_HP_ODR_DIV_800
Issue :
We are measuring the acceleration RMS and velocity of a compressor/chiller/motor in an industrial setting during normal operation. Despite the IIS3DWB sensor providing output in all three axes, we are considering only the Y-axis, which aligns with the SPM Vib-15.
We have taken readings for acceleration peak, acceleration RMS, and speed RMS using both our device and the SPM Vib-15. However, our device’s readings are significantly different from those of the SPM Vib-15, particularly at higher vibration levels (almost double). The acceleration RMS values have been converted to G to match the units used by the vibrameter, and velocity RMS values are already in mm/s for both devices.
Problem :
Despite similar measurement conditions and proper mounting of both devices, our readings do not match the SPM Vib-15 readings. Given that both devices serve the same application, should we expect the digital sensor data from the IIS3DWB to closely align with the analog sensor output from the SPM Vib-15?
Are we making an error by comparing the outputs of an analog sensor to those of a digital sensor? What could be causing these discrepancies?
We have also attempted linear regression for calibration, but it did not resolve the issue.
Additional Information :
Images:
First from the right side is the SPM vibrameter, and last one (biggest one) is our device.
mounted in vertical direction
mounted in horizontal direction
(in this image at the center is our device)
the third device is for refference (blue one) , which has same sansor that we are using in our device.
Data brief of that device: https://www.st.com/resource/en/data_brief/steval-stwinkt1b.pdf predictive_maintenance, condition_monitoring, spm_vib_15 MATLAB Answers — New Questions
Can I use quadprog solver in an Explicit MPC?
Hi,
I have a question regarding to using quadprog solver. Can I use quadprog solver to obtain all the regions for a Explicit MPC?
I have this in my code (thinking that maybe I can use quadprog solver)
% Generate explicit MPC controller
mpcobj.Optimizer.Solver = ‘interior-point’;
setCustomSolver(mpcobj,’quadprog’);
My other question is can I change the cost function that the Explicit MPC will minimize when it will obtain the controller? How?
Thanks in advance
DaveHi,
I have a question regarding to using quadprog solver. Can I use quadprog solver to obtain all the regions for a Explicit MPC?
I have this in my code (thinking that maybe I can use quadprog solver)
% Generate explicit MPC controller
mpcobj.Optimizer.Solver = ‘interior-point’;
setCustomSolver(mpcobj,’quadprog’);
My other question is can I change the cost function that the Explicit MPC will minimize when it will obtain the controller? How?
Thanks in advance
Dave Hi,
I have a question regarding to using quadprog solver. Can I use quadprog solver to obtain all the regions for a Explicit MPC?
I have this in my code (thinking that maybe I can use quadprog solver)
% Generate explicit MPC controller
mpcobj.Optimizer.Solver = ‘interior-point’;
setCustomSolver(mpcobj,’quadprog’);
My other question is can I change the cost function that the Explicit MPC will minimize when it will obtain the controller? How?
Thanks in advance
Dave mpc, explicit mpc, solve MATLAB Answers — New Questions
I am facing an issue while converting my OFDM code from matlab to HDL during fixed point conversion
This is my ofdm code , which simulates ofdm reciever and transmitter , over a rayleigh channel , using 16Qam modulation, with doppler.
function [BitsRx] = OfdmDopplerBer(~)
Rs = 54.64e5;
% Symbol Duration, [s]
Ts = 1/Rs;
% Carrier Frequency, [Hz]
f = 1.5e9;
% Modulation Order of QPSK by definition
M = 16;
% Number of Bits in QPSK Symbol
k = log2(M);
% QPSK Signal Bandwidth, [Hz]
F = 1/Ts;
% Number of Subcarriers (equal to Number of FFT points)
numSC = 1024;
%NumSymbols=3;
% Guard Bands Subcarriers
GuardBandSC = [10; 10];
% Central Null Subcarrier
DCNull = true;
DCNullSC = numSC/2 + 1;
% Number of Pilot Subcarriers
numPilotSC = 10;
PilotSC =[15 125 236 346 456 567 677 787 898 1008]’;
% Length of Cyclic Prefix
lenCP = numSC/4;
% OFDM Modulator Object
OFDMModulator = comm.OFDMModulator( …
‘FFTLength’, numSC, …
‘NumGuardBandCarriers’, GuardBandSC, …
‘Windowing’,true,…
‘InsertDCNull’, DCNull, …
‘PilotInputPort’, true, …
‘PilotCarrierIndices’, PilotSC, …
‘CyclicPrefixLength’, lenCP);
OFDMDemodulator = comm.OFDMDemodulator(OFDMModulator);
% Mapping of Subcarriers in Time-Frequency Space
%showResourceMapping(OFDMModulator)
% Number of Data Subcarriers
numDataSC = info(OFDMModulator).DataInputSize(1);
% Size of Data Frame
szDataFrame = [numDataSC 1];
% Size of Pilot Frame
szPilotFrame = info(OFDMModulator).PilotInputSize;
% OFDM Symbol Duration with Cyclic Prefix, [s]
Ts_OFDM = (numSC + lenCP)*Ts;
% OFDM Symbol Rate with Cyclic Prefix, [1/s]
Rs_OFDM = 1/Ts_OFDM;
% Decreasing of Symbol Rate by using OFDM
Rs/Rs_OFDM;
% Subcarrier Bandwidth, [Hz]
F_SC = F/numSC;
clear ans
% Discrete Paths Relative Delays, [s]
PathDelays = [0 3 5 6 11]*Ts ;
% Discrete Paths Max Delay, [s]
Tm = max(PathDelays);
% Channel Coherence Bandwidth [2, p. 960; 3, p. 399], [Hz]
Fc = 1/Tm;
% Discrete Paths Average Gains, [dB]
PathAvGains = [0 -8 -17 -21 -25];
% Discrete Paths K Factors
K = [0.1 0.1 0.1 0.1 0.1];
% Approximate Speed of Ionospheric Irregularities, [m/s]
v=170.14;
% Light Speed, [m/s]
c = 3e8;
% Max Doppler Frequency Shift for all Discrete Paths, [Hz]
fD = v*f/c;
% Channel Coherence Time [3, p. 400], [s]
Tc = 1/fD;
spsSync = 1;
norms = [1 sqrt(2) 0 sqrt(10) 0 sqrt(42)];
doppler1 = comm.PhaseFrequencyOffset( …
FrequencyOffset=fD, …
PhaseOffset=0, …
SampleRate=Rs);
varDelay = dsp.VariableFractionalDelay;
%% Rician Channel Object
RicianFadingChannel = comm.RicianChannel( …
‘SampleRate’, Rs, …
‘PathDelays’, PathDelays, …
‘AveragePathGains’, PathAvGains, …
‘NormalizePathGains’, true, …
‘KFactor’, K, …
‘MaximumDopplerShift’, fD, …
‘DirectPathDopplerShift’, zeros(size(K)), …
‘DirectPathInitialPhase’, zeros(size(K)), …
‘DopplerSpectrum’, doppler(‘Jakes’) …
);
% Delay in Channel Object, [sample]
ChanDelay = info(RicianFadingChannel).ChannelFilterDelay;
%% AWGN Channel Object
AWGNChannel = comm.AWGNChannel( …
‘NoiseMethod’, ‘Signal to noise ratio (SNR)’, …
‘SNR’, 0 …
);
% table(F, F_SC, Fc, fD, ‘VariableNames’, {‘F, [Hz]’, ‘F_SC, [Hz]’, ‘Fc, [Hz]’, ‘fD, [Hz]’})
% table(Ts, Ts_OFDM, Tm, Tc, ‘VariableNames’, {‘Ts, [s]’, ‘Ts_OFDM, [s]’, ‘Tm, [s]’, ‘Tc, [s]’})
% Range of Eb/N0
EbNo = 0:60;
% Number of Transmitted Frames
numFrames = 500;
% BER Calculators Object
BERCalculater = comm.ErrorRate;
% BER Variable for Imitation Modeling Result
BER = zeros(3,length(EbNo));
% Loop for the Range of Eb/N0
for n = 1:length(EbNo)
% Setting the Eb/No in AWGN Channel Object
AWGNChannel.SNR = EbNo(n) + 10*log10(k) + 10*log10(numDataSC/numSC);
% BER Calculation
reset(BERCalculater);
BERn = zeros(3,1);
% Loop for the Number of Transmitted Frames
for fr = 1:numFrames
% >>> Transmitter >>>
% Generation of Data Bits
BitsTx = randi([0 M-1], [szDataFrame,1]);
constellation = qammod(0:M-1, M, ‘gray’);
% Normalize the constellation
constellation = constellation / norms(k);
% Apply phase offset
% constellation = constellation * exp(1i * phaseOffset);
% Define General QAM Modulator with custom constellation
QAMModulator = comm.GeneralQAMModulator(‘Constellation’, constellation);
SignalTx1 = zeros(szDataFrame);
% Modulate the data symbols
SignalTx1 = QAMModulator(BitsTx);
% Generation of Pilot Signals
PilotSignalTx = complex(ones(szPilotFrame), zeros(szPilotFrame));
% OFDM Modulation
SignalTx2 = OFDMModulator(SignalTx1, PilotSignalTx);
% Power of Transmitted Signal
% Compute the power of the transmitted signal
SignalTxPower = sum(abs(SignalTx2).^2) / length(SignalTx2);
% Adding zero samples to the end of Transmitted Signal
% to not lose shifted samples caused by delay after Rician Channel
SignalTx2 = [SignalTx2; zeros(ChanDelay, 1)];
%SignalTx2_with_pfo = pfo(SignalTx2);
%%
% Rician Channel
SignalChan1 = RicianFadingChannel(SignalTx2);
% Removing first ChanDelay samples and
% selection of Channel’s Signal related to Transmitted Signal
SignalChan1 = SignalChan1(ChanDelay + 1 : end);
%% introducing the delay in frequency and symbol time due to doppler
txDoppler = doppler1(SignalChan1);
txDelay = varDelay(txDoppler, fr/numFrames);
SignalChan3=txDelay;
%%
% AWGN Channel
AWGNChannel.SignalPower = SignalTxPower;
SignalChan2 = AWGNChannel(SignalChan3);
% >>> Receiver >>>
% OFDM Demodulation
[SignalRx1, PilotSignalRx] = OFDMDemodulator(SignalChan2);
%%
% LS Channel Estimation
% Obtaining discrete points of Channel Frequency Response
% based on dividing the Received Pilot Signals by the known ones
ChanFR_dp = PilotSignalRx ./ PilotSignalTx;
% Interpolation of Channel Frequency Response
% ChanFR_int = zeros(numSC, 1); % Preallocate the result array
ChanFR_int = fixed.interp1( …
PilotSC, …
ChanFR_dp, …
GuardBandSC(1) + 1 : numSC – GuardBandSC(2), …
‘linear’ …
);
% Selection of Data Subcarriers components of Frequency Response
% by cutting out components of Pilot and DC Subcarriers
% Remove components of Pilot and DC Subcarriers
ChanFR_int([PilotSC; DCNullSC] – GuardBandSC(1)) = [];
% LS Solution
SignalRx2 = SignalRx1./ ChanFR_int.’;
% 2. Denormalize the signal
SignalRx2 = SignalRx2* norms(k);
QAMDemodulator = comm.GeneralQAMDemodulator(‘Constellation’,…
qammod(0:M-1, M, ‘gray’));
% Demodulate the received signal
BitsRx = QAMDemodulator(SignalRx2);
%BitsRx = qamdemod(SignalRx2*sqrt(10),M,"gray");
% BER Calculation
BERn = BERCalculater(BitsTx, BitsRx);
end
% BER Results
BER(:,n) = BERn;
end
clear n fr BERn
disp(BitsRx);
end
I am trying to convert this code to hdl, but am facing this error in the fixed point conversion part
Expected input 1 to have fixed dimensions for System object comm.OFDMModulator.
refering to this line
SignalTx2 = OFDMModulator(SignalTx1, PilotSignalTx);
Can someone help with this ?This is my ofdm code , which simulates ofdm reciever and transmitter , over a rayleigh channel , using 16Qam modulation, with doppler.
function [BitsRx] = OfdmDopplerBer(~)
Rs = 54.64e5;
% Symbol Duration, [s]
Ts = 1/Rs;
% Carrier Frequency, [Hz]
f = 1.5e9;
% Modulation Order of QPSK by definition
M = 16;
% Number of Bits in QPSK Symbol
k = log2(M);
% QPSK Signal Bandwidth, [Hz]
F = 1/Ts;
% Number of Subcarriers (equal to Number of FFT points)
numSC = 1024;
%NumSymbols=3;
% Guard Bands Subcarriers
GuardBandSC = [10; 10];
% Central Null Subcarrier
DCNull = true;
DCNullSC = numSC/2 + 1;
% Number of Pilot Subcarriers
numPilotSC = 10;
PilotSC =[15 125 236 346 456 567 677 787 898 1008]’;
% Length of Cyclic Prefix
lenCP = numSC/4;
% OFDM Modulator Object
OFDMModulator = comm.OFDMModulator( …
‘FFTLength’, numSC, …
‘NumGuardBandCarriers’, GuardBandSC, …
‘Windowing’,true,…
‘InsertDCNull’, DCNull, …
‘PilotInputPort’, true, …
‘PilotCarrierIndices’, PilotSC, …
‘CyclicPrefixLength’, lenCP);
OFDMDemodulator = comm.OFDMDemodulator(OFDMModulator);
% Mapping of Subcarriers in Time-Frequency Space
%showResourceMapping(OFDMModulator)
% Number of Data Subcarriers
numDataSC = info(OFDMModulator).DataInputSize(1);
% Size of Data Frame
szDataFrame = [numDataSC 1];
% Size of Pilot Frame
szPilotFrame = info(OFDMModulator).PilotInputSize;
% OFDM Symbol Duration with Cyclic Prefix, [s]
Ts_OFDM = (numSC + lenCP)*Ts;
% OFDM Symbol Rate with Cyclic Prefix, [1/s]
Rs_OFDM = 1/Ts_OFDM;
% Decreasing of Symbol Rate by using OFDM
Rs/Rs_OFDM;
% Subcarrier Bandwidth, [Hz]
F_SC = F/numSC;
clear ans
% Discrete Paths Relative Delays, [s]
PathDelays = [0 3 5 6 11]*Ts ;
% Discrete Paths Max Delay, [s]
Tm = max(PathDelays);
% Channel Coherence Bandwidth [2, p. 960; 3, p. 399], [Hz]
Fc = 1/Tm;
% Discrete Paths Average Gains, [dB]
PathAvGains = [0 -8 -17 -21 -25];
% Discrete Paths K Factors
K = [0.1 0.1 0.1 0.1 0.1];
% Approximate Speed of Ionospheric Irregularities, [m/s]
v=170.14;
% Light Speed, [m/s]
c = 3e8;
% Max Doppler Frequency Shift for all Discrete Paths, [Hz]
fD = v*f/c;
% Channel Coherence Time [3, p. 400], [s]
Tc = 1/fD;
spsSync = 1;
norms = [1 sqrt(2) 0 sqrt(10) 0 sqrt(42)];
doppler1 = comm.PhaseFrequencyOffset( …
FrequencyOffset=fD, …
PhaseOffset=0, …
SampleRate=Rs);
varDelay = dsp.VariableFractionalDelay;
%% Rician Channel Object
RicianFadingChannel = comm.RicianChannel( …
‘SampleRate’, Rs, …
‘PathDelays’, PathDelays, …
‘AveragePathGains’, PathAvGains, …
‘NormalizePathGains’, true, …
‘KFactor’, K, …
‘MaximumDopplerShift’, fD, …
‘DirectPathDopplerShift’, zeros(size(K)), …
‘DirectPathInitialPhase’, zeros(size(K)), …
‘DopplerSpectrum’, doppler(‘Jakes’) …
);
% Delay in Channel Object, [sample]
ChanDelay = info(RicianFadingChannel).ChannelFilterDelay;
%% AWGN Channel Object
AWGNChannel = comm.AWGNChannel( …
‘NoiseMethod’, ‘Signal to noise ratio (SNR)’, …
‘SNR’, 0 …
);
% table(F, F_SC, Fc, fD, ‘VariableNames’, {‘F, [Hz]’, ‘F_SC, [Hz]’, ‘Fc, [Hz]’, ‘fD, [Hz]’})
% table(Ts, Ts_OFDM, Tm, Tc, ‘VariableNames’, {‘Ts, [s]’, ‘Ts_OFDM, [s]’, ‘Tm, [s]’, ‘Tc, [s]’})
% Range of Eb/N0
EbNo = 0:60;
% Number of Transmitted Frames
numFrames = 500;
% BER Calculators Object
BERCalculater = comm.ErrorRate;
% BER Variable for Imitation Modeling Result
BER = zeros(3,length(EbNo));
% Loop for the Range of Eb/N0
for n = 1:length(EbNo)
% Setting the Eb/No in AWGN Channel Object
AWGNChannel.SNR = EbNo(n) + 10*log10(k) + 10*log10(numDataSC/numSC);
% BER Calculation
reset(BERCalculater);
BERn = zeros(3,1);
% Loop for the Number of Transmitted Frames
for fr = 1:numFrames
% >>> Transmitter >>>
% Generation of Data Bits
BitsTx = randi([0 M-1], [szDataFrame,1]);
constellation = qammod(0:M-1, M, ‘gray’);
% Normalize the constellation
constellation = constellation / norms(k);
% Apply phase offset
% constellation = constellation * exp(1i * phaseOffset);
% Define General QAM Modulator with custom constellation
QAMModulator = comm.GeneralQAMModulator(‘Constellation’, constellation);
SignalTx1 = zeros(szDataFrame);
% Modulate the data symbols
SignalTx1 = QAMModulator(BitsTx);
% Generation of Pilot Signals
PilotSignalTx = complex(ones(szPilotFrame), zeros(szPilotFrame));
% OFDM Modulation
SignalTx2 = OFDMModulator(SignalTx1, PilotSignalTx);
% Power of Transmitted Signal
% Compute the power of the transmitted signal
SignalTxPower = sum(abs(SignalTx2).^2) / length(SignalTx2);
% Adding zero samples to the end of Transmitted Signal
% to not lose shifted samples caused by delay after Rician Channel
SignalTx2 = [SignalTx2; zeros(ChanDelay, 1)];
%SignalTx2_with_pfo = pfo(SignalTx2);
%%
% Rician Channel
SignalChan1 = RicianFadingChannel(SignalTx2);
% Removing first ChanDelay samples and
% selection of Channel’s Signal related to Transmitted Signal
SignalChan1 = SignalChan1(ChanDelay + 1 : end);
%% introducing the delay in frequency and symbol time due to doppler
txDoppler = doppler1(SignalChan1);
txDelay = varDelay(txDoppler, fr/numFrames);
SignalChan3=txDelay;
%%
% AWGN Channel
AWGNChannel.SignalPower = SignalTxPower;
SignalChan2 = AWGNChannel(SignalChan3);
% >>> Receiver >>>
% OFDM Demodulation
[SignalRx1, PilotSignalRx] = OFDMDemodulator(SignalChan2);
%%
% LS Channel Estimation
% Obtaining discrete points of Channel Frequency Response
% based on dividing the Received Pilot Signals by the known ones
ChanFR_dp = PilotSignalRx ./ PilotSignalTx;
% Interpolation of Channel Frequency Response
% ChanFR_int = zeros(numSC, 1); % Preallocate the result array
ChanFR_int = fixed.interp1( …
PilotSC, …
ChanFR_dp, …
GuardBandSC(1) + 1 : numSC – GuardBandSC(2), …
‘linear’ …
);
% Selection of Data Subcarriers components of Frequency Response
% by cutting out components of Pilot and DC Subcarriers
% Remove components of Pilot and DC Subcarriers
ChanFR_int([PilotSC; DCNullSC] – GuardBandSC(1)) = [];
% LS Solution
SignalRx2 = SignalRx1./ ChanFR_int.’;
% 2. Denormalize the signal
SignalRx2 = SignalRx2* norms(k);
QAMDemodulator = comm.GeneralQAMDemodulator(‘Constellation’,…
qammod(0:M-1, M, ‘gray’));
% Demodulate the received signal
BitsRx = QAMDemodulator(SignalRx2);
%BitsRx = qamdemod(SignalRx2*sqrt(10),M,"gray");
% BER Calculation
BERn = BERCalculater(BitsTx, BitsRx);
end
% BER Results
BER(:,n) = BERn;
end
clear n fr BERn
disp(BitsRx);
end
I am trying to convert this code to hdl, but am facing this error in the fixed point conversion part
Expected input 1 to have fixed dimensions for System object comm.OFDMModulator.
refering to this line
SignalTx2 = OFDMModulator(SignalTx1, PilotSignalTx);
Can someone help with this ? This is my ofdm code , which simulates ofdm reciever and transmitter , over a rayleigh channel , using 16Qam modulation, with doppler.
function [BitsRx] = OfdmDopplerBer(~)
Rs = 54.64e5;
% Symbol Duration, [s]
Ts = 1/Rs;
% Carrier Frequency, [Hz]
f = 1.5e9;
% Modulation Order of QPSK by definition
M = 16;
% Number of Bits in QPSK Symbol
k = log2(M);
% QPSK Signal Bandwidth, [Hz]
F = 1/Ts;
% Number of Subcarriers (equal to Number of FFT points)
numSC = 1024;
%NumSymbols=3;
% Guard Bands Subcarriers
GuardBandSC = [10; 10];
% Central Null Subcarrier
DCNull = true;
DCNullSC = numSC/2 + 1;
% Number of Pilot Subcarriers
numPilotSC = 10;
PilotSC =[15 125 236 346 456 567 677 787 898 1008]’;
% Length of Cyclic Prefix
lenCP = numSC/4;
% OFDM Modulator Object
OFDMModulator = comm.OFDMModulator( …
‘FFTLength’, numSC, …
‘NumGuardBandCarriers’, GuardBandSC, …
‘Windowing’,true,…
‘InsertDCNull’, DCNull, …
‘PilotInputPort’, true, …
‘PilotCarrierIndices’, PilotSC, …
‘CyclicPrefixLength’, lenCP);
OFDMDemodulator = comm.OFDMDemodulator(OFDMModulator);
% Mapping of Subcarriers in Time-Frequency Space
%showResourceMapping(OFDMModulator)
% Number of Data Subcarriers
numDataSC = info(OFDMModulator).DataInputSize(1);
% Size of Data Frame
szDataFrame = [numDataSC 1];
% Size of Pilot Frame
szPilotFrame = info(OFDMModulator).PilotInputSize;
% OFDM Symbol Duration with Cyclic Prefix, [s]
Ts_OFDM = (numSC + lenCP)*Ts;
% OFDM Symbol Rate with Cyclic Prefix, [1/s]
Rs_OFDM = 1/Ts_OFDM;
% Decreasing of Symbol Rate by using OFDM
Rs/Rs_OFDM;
% Subcarrier Bandwidth, [Hz]
F_SC = F/numSC;
clear ans
% Discrete Paths Relative Delays, [s]
PathDelays = [0 3 5 6 11]*Ts ;
% Discrete Paths Max Delay, [s]
Tm = max(PathDelays);
% Channel Coherence Bandwidth [2, p. 960; 3, p. 399], [Hz]
Fc = 1/Tm;
% Discrete Paths Average Gains, [dB]
PathAvGains = [0 -8 -17 -21 -25];
% Discrete Paths K Factors
K = [0.1 0.1 0.1 0.1 0.1];
% Approximate Speed of Ionospheric Irregularities, [m/s]
v=170.14;
% Light Speed, [m/s]
c = 3e8;
% Max Doppler Frequency Shift for all Discrete Paths, [Hz]
fD = v*f/c;
% Channel Coherence Time [3, p. 400], [s]
Tc = 1/fD;
spsSync = 1;
norms = [1 sqrt(2) 0 sqrt(10) 0 sqrt(42)];
doppler1 = comm.PhaseFrequencyOffset( …
FrequencyOffset=fD, …
PhaseOffset=0, …
SampleRate=Rs);
varDelay = dsp.VariableFractionalDelay;
%% Rician Channel Object
RicianFadingChannel = comm.RicianChannel( …
‘SampleRate’, Rs, …
‘PathDelays’, PathDelays, …
‘AveragePathGains’, PathAvGains, …
‘NormalizePathGains’, true, …
‘KFactor’, K, …
‘MaximumDopplerShift’, fD, …
‘DirectPathDopplerShift’, zeros(size(K)), …
‘DirectPathInitialPhase’, zeros(size(K)), …
‘DopplerSpectrum’, doppler(‘Jakes’) …
);
% Delay in Channel Object, [sample]
ChanDelay = info(RicianFadingChannel).ChannelFilterDelay;
%% AWGN Channel Object
AWGNChannel = comm.AWGNChannel( …
‘NoiseMethod’, ‘Signal to noise ratio (SNR)’, …
‘SNR’, 0 …
);
% table(F, F_SC, Fc, fD, ‘VariableNames’, {‘F, [Hz]’, ‘F_SC, [Hz]’, ‘Fc, [Hz]’, ‘fD, [Hz]’})
% table(Ts, Ts_OFDM, Tm, Tc, ‘VariableNames’, {‘Ts, [s]’, ‘Ts_OFDM, [s]’, ‘Tm, [s]’, ‘Tc, [s]’})
% Range of Eb/N0
EbNo = 0:60;
% Number of Transmitted Frames
numFrames = 500;
% BER Calculators Object
BERCalculater = comm.ErrorRate;
% BER Variable for Imitation Modeling Result
BER = zeros(3,length(EbNo));
% Loop for the Range of Eb/N0
for n = 1:length(EbNo)
% Setting the Eb/No in AWGN Channel Object
AWGNChannel.SNR = EbNo(n) + 10*log10(k) + 10*log10(numDataSC/numSC);
% BER Calculation
reset(BERCalculater);
BERn = zeros(3,1);
% Loop for the Number of Transmitted Frames
for fr = 1:numFrames
% >>> Transmitter >>>
% Generation of Data Bits
BitsTx = randi([0 M-1], [szDataFrame,1]);
constellation = qammod(0:M-1, M, ‘gray’);
% Normalize the constellation
constellation = constellation / norms(k);
% Apply phase offset
% constellation = constellation * exp(1i * phaseOffset);
% Define General QAM Modulator with custom constellation
QAMModulator = comm.GeneralQAMModulator(‘Constellation’, constellation);
SignalTx1 = zeros(szDataFrame);
% Modulate the data symbols
SignalTx1 = QAMModulator(BitsTx);
% Generation of Pilot Signals
PilotSignalTx = complex(ones(szPilotFrame), zeros(szPilotFrame));
% OFDM Modulation
SignalTx2 = OFDMModulator(SignalTx1, PilotSignalTx);
% Power of Transmitted Signal
% Compute the power of the transmitted signal
SignalTxPower = sum(abs(SignalTx2).^2) / length(SignalTx2);
% Adding zero samples to the end of Transmitted Signal
% to not lose shifted samples caused by delay after Rician Channel
SignalTx2 = [SignalTx2; zeros(ChanDelay, 1)];
%SignalTx2_with_pfo = pfo(SignalTx2);
%%
% Rician Channel
SignalChan1 = RicianFadingChannel(SignalTx2);
% Removing first ChanDelay samples and
% selection of Channel’s Signal related to Transmitted Signal
SignalChan1 = SignalChan1(ChanDelay + 1 : end);
%% introducing the delay in frequency and symbol time due to doppler
txDoppler = doppler1(SignalChan1);
txDelay = varDelay(txDoppler, fr/numFrames);
SignalChan3=txDelay;
%%
% AWGN Channel
AWGNChannel.SignalPower = SignalTxPower;
SignalChan2 = AWGNChannel(SignalChan3);
% >>> Receiver >>>
% OFDM Demodulation
[SignalRx1, PilotSignalRx] = OFDMDemodulator(SignalChan2);
%%
% LS Channel Estimation
% Obtaining discrete points of Channel Frequency Response
% based on dividing the Received Pilot Signals by the known ones
ChanFR_dp = PilotSignalRx ./ PilotSignalTx;
% Interpolation of Channel Frequency Response
% ChanFR_int = zeros(numSC, 1); % Preallocate the result array
ChanFR_int = fixed.interp1( …
PilotSC, …
ChanFR_dp, …
GuardBandSC(1) + 1 : numSC – GuardBandSC(2), …
‘linear’ …
);
% Selection of Data Subcarriers components of Frequency Response
% by cutting out components of Pilot and DC Subcarriers
% Remove components of Pilot and DC Subcarriers
ChanFR_int([PilotSC; DCNullSC] – GuardBandSC(1)) = [];
% LS Solution
SignalRx2 = SignalRx1./ ChanFR_int.’;
% 2. Denormalize the signal
SignalRx2 = SignalRx2* norms(k);
QAMDemodulator = comm.GeneralQAMDemodulator(‘Constellation’,…
qammod(0:M-1, M, ‘gray’));
% Demodulate the received signal
BitsRx = QAMDemodulator(SignalRx2);
%BitsRx = qamdemod(SignalRx2*sqrt(10),M,"gray");
% BER Calculation
BERn = BERCalculater(BitsTx, BitsRx);
end
% BER Results
BER(:,n) = BERn;
end
clear n fr BERn
disp(BitsRx);
end
I am trying to convert this code to hdl, but am facing this error in the fixed point conversion part
Expected input 1 to have fixed dimensions for System object comm.OFDMModulator.
refering to this line
SignalTx2 = OFDMModulator(SignalTx1, PilotSignalTx);
Can someone help with this ? ofdm, doppler, rayleigh channel MATLAB Answers — New Questions
How can I use ginput in app designer?
I would like to select a range of points from one particular UIAxes in my app.
I have tried to use ginput ([x,y=ginput]), but the applications prompts an additional empty plot to select the range of points. How can I point an specific UIAxes?
Kind RegardsI would like to select a range of points from one particular UIAxes in my app.
I have tried to use ginput ([x,y=ginput]), but the applications prompts an additional empty plot to select the range of points. How can I point an specific UIAxes?
Kind Regards I would like to select a range of points from one particular UIAxes in my app.
I have tried to use ginput ([x,y=ginput]), but the applications prompts an additional empty plot to select the range of points. How can I point an specific UIAxes?
Kind Regards ginput app MATLAB Answers — New Questions
How to define an array based on Simulink simulation time?
Hello everyone, I’m attempting to define an array in a MATLAB Function block based on the simulation time in Simulink. In my code, I use ‘times index’ to record the number of simulation steps. I have set the time step to 0.01s.To achieve this goal, I used ‘persistent’ variables, but encountered an error. How can I implement my objective?
function [y,y1] = fcn(u)
persistent inputs; % 声明一个持久变量用于保存输入值
persistent time_index;
if isempty(inputs) % 如果持久变量为空,则初始化
inputs = u; % 将当前输入值保存到持久变量中
time_index = 1;
else
inputs = [inputs, u]; % 将当前输入值追加到持久变量中
time_index = time_index + 1;
end
% 计算平均值
mean_val = mean(inputs);
% 计算差值的平方
diff_squared = (inputs – mean_val).^2;
% 计算方差
y = sum(diff_squared) / length(inputs);
all_inputs(time_index) = u;
y1=all_inputs;
This is the error I encountered.Hello everyone, I’m attempting to define an array in a MATLAB Function block based on the simulation time in Simulink. In my code, I use ‘times index’ to record the number of simulation steps. I have set the time step to 0.01s.To achieve this goal, I used ‘persistent’ variables, but encountered an error. How can I implement my objective?
function [y,y1] = fcn(u)
persistent inputs; % 声明一个持久变量用于保存输入值
persistent time_index;
if isempty(inputs) % 如果持久变量为空,则初始化
inputs = u; % 将当前输入值保存到持久变量中
time_index = 1;
else
inputs = [inputs, u]; % 将当前输入值追加到持久变量中
time_index = time_index + 1;
end
% 计算平均值
mean_val = mean(inputs);
% 计算差值的平方
diff_squared = (inputs – mean_val).^2;
% 计算方差
y = sum(diff_squared) / length(inputs);
all_inputs(time_index) = u;
y1=all_inputs;
This is the error I encountered. Hello everyone, I’m attempting to define an array in a MATLAB Function block based on the simulation time in Simulink. In my code, I use ‘times index’ to record the number of simulation steps. I have set the time step to 0.01s.To achieve this goal, I used ‘persistent’ variables, but encountered an error. How can I implement my objective?
function [y,y1] = fcn(u)
persistent inputs; % 声明一个持久变量用于保存输入值
persistent time_index;
if isempty(inputs) % 如果持久变量为空,则初始化
inputs = u; % 将当前输入值保存到持久变量中
time_index = 1;
else
inputs = [inputs, u]; % 将当前输入值追加到持久变量中
time_index = time_index + 1;
end
% 计算平均值
mean_val = mean(inputs);
% 计算差值的平方
diff_squared = (inputs – mean_val).^2;
% 计算方差
y = sum(diff_squared) / length(inputs);
all_inputs(time_index) = u;
y1=all_inputs;
This is the error I encountered. simulink, matlab function, array define MATLAB Answers — New Questions
Geographical binning with HISTA not creating squares
Hello everybody!
My data contains latitude, longitute, time and multiple other variables. I need to bin this data for my needs.
>> head(w_files{1})
time lon lat pci_lte sinr_lte cinr_lte rsrp_lte prb_dl_lte prb_ul_lte bler_dl_lte bler_ul_lte mod_dl_0_lte mod_dl_1_lte mod_ul_lte earfnc_dl_lte earfnc_ul_lte tp_mac_dl_lte tp_mac_ul_lte tp_pdsch_lte tp_pusch_lte tp_pdcp_dl_lte tp_pdcp_ul_lte tm tx_rx bw_dl_lte bw_ul_lte band ca_dl ca_ul ca_comb
_______________________ ______ ______ _______ ________ ________ ________ __________ __________ ___________ ___________ ____________ ____________ __________ _____________ _____________ _____________ _____________ ____________ ____________ ______________ ______________ __________ _____________ _________ _________ ___________ __________ __________ _________________________
2020-12-08 11:48:13.000 14.563 50.035 NaN NaN 0 NaN NaN NaN NaN NaN {0×0 char} {0×0 char} {0×0 char} NaN NaN NaN NaN NaN NaN NaN NaN {0×0 char} {0×0 char } NaN NaN {0×0 char } {0×0 char} {0×0 char} {0×0 char }
2020-12-08 11:48:14.000 14.563 50.035 374 NaN 0 -61 41.49 0.74 9 5 {‘256QAM’} {0×0 char} {0×0 char} 6200 24200 238.43 0.002 238.43 0.327 0 0 {‘TM4’ } {‘MIMO(4×2)’} 10 10 {‘Band 20’} {‘3CA’ } {‘NonCA’ } {‘Band 20+Band 7+Band 3’}
2020-12-08 11:48:15.000 14.563 50.035 374 11 0 -61 43.3 0.7 7 2 {‘256QAM’} {0×0 char} {0×0 char} 6200 24200 256.08 0.002 256.08 0.314 0 0 {‘TM4’ } {‘MIMO(4×2)’} 10 10 {‘Band 20’} {‘3CA’ } {‘NonCA’ } {‘Band 20+Band 7+Band 3’}
2020-12-08 11:48:16.000 14.563 50.035 374 10 0 -61 44.31 0.69 6 2 {‘256QAM’} {0×0 char} {0×0 char} 6200 24200 257.2 0.001 257.2 0.324 0 0 {‘TM4’ } {‘MIMO(4×2)’} 10 10 {‘Band 20’} {‘3CA’ } {‘NonCA’ } {‘Band 20+Band 7+Band 3’}
2020-12-08 11:48:17.000 14.563 50.035 374 10 0 -61 43.57 0.81 6 0 {‘256QAM’} {0×0 char} {0×0 char} 6200 24200 252.94 0.001 252.94 0.357 0 0 {‘TM4’ } {‘MIMO(4×2)’} 10 10 {‘Band 20’} {‘3CA’ } {‘NonCA’ } {‘Band 20+Band 7+Band 3’}
2020-12-08 11:48:18.000 14.563 50.035 374 9 0 -63 44.93 0.79 7 0 {’64QAM’ } {0×0 char} {0×0 char} 6200 24200 226.24 0.002 226.24 0.35 0 0 {‘TM4’ } {‘MIMO(4×2)’} 10 10 {‘Band 20’} {‘3CA’ } {‘NonCA’ } {‘Band 20+Band 7+Band 3’}
2020-12-08 11:48:19.000 14.563 50.035 374 7 0 -62 44.45 0.8 11 0 {’16QAM’ } {0×0 char} {0×0 char} 6200 24200 191.17 0.002 191.17 0.359 0 0 {‘TM4’ } {‘MIMO(4×2)’} 10 10 {‘Band 20’} {‘3CA’ } {‘NonCA’ } {‘Band 20+Band 7+Band 3’}
2020-12-08 11:48:20.000 14.563 50.035 374 2 0 -66 44.18 0.82 12 2 {’16QAM’ } {0×0 char} {0×0 char} 6200 24200 177.6 0.002 177.6 0.372 0 0 {‘TM4’ } {‘MIMO(4×2)’} 10 10 {‘Band 20’} {‘3CA’ } {‘NonCA’ } {‘Band 20+Band 7+Band 3’}
I am using HISTA to find a 20×20 meters grid and applying it on the data sets.
[latbin, lonbin] = hista(w_files{ii}.lat,w_files{ii}.lon,0.0004);% bin at 20x20m,hista binning + computing binsID
[w_files{ii}.latEq, w_files{ii}.lonEq] = grn2eqa(w_files{ii}.lat,w_files{ii}.lon);% Convert coordinates to equidistant cartesian coordinates
[latbinEq, lonbinEq] = grn2eqa(latbin, lonbin);% Convert coordinates to equidistant cartesian coordinates
dist = pdist2([w_files{ii}.lonEq,w_files{ii}.latEq],[lonbinEq, latbinEq]);% Compute distance between each coordinate and each bin-center
[~, w_files{ii}.bin20] = min(dist,[],2);% Add bin ID numbers to table
When I run a figure with plot_google_map I am not getting squares but rectangles. Right now, I am not sure if I am just displaying it wrong or I have made some mistake in the binning. I have added one sample file for you guys to try. (You will need plot_google_map function to have the map picture but this issue is clearly visible without it as well).
figure()
hold on
scatter(lonbin, latbin, 200, 1:numel(lonbin), ‘Marker’,’*’,’LineWidth’,2) % bin centers
scatter(w_files{ii}.lon,w_files{ii}.lat, 50,w_files{ii}.bin20,’filled’)
cmap = colorcube(255);
colormap(cmap(1:end-10,:))
xlabel(‘longitude’); ylabel(‘latitude’)
latbinUnq = unique(latbin);
lonbinUnq = unique(lonbin);
set(gca, ‘xtick’, lonbinUnq(2:end)-diff(lonbinUnq)/2,’ytick’,latbinUnq(2:end)-diff(latbinUnq)/2)
grid on
plot_google_map(‘Scale’,2,’resize’,2,’ShowLabels’,0)%google_plot settings
What do you think? If you think you know the answer, please be very specific because I am a beginner and I might be dumb.Hello everybody!
My data contains latitude, longitute, time and multiple other variables. I need to bin this data for my needs.
>> head(w_files{1})
time lon lat pci_lte sinr_lte cinr_lte rsrp_lte prb_dl_lte prb_ul_lte bler_dl_lte bler_ul_lte mod_dl_0_lte mod_dl_1_lte mod_ul_lte earfnc_dl_lte earfnc_ul_lte tp_mac_dl_lte tp_mac_ul_lte tp_pdsch_lte tp_pusch_lte tp_pdcp_dl_lte tp_pdcp_ul_lte tm tx_rx bw_dl_lte bw_ul_lte band ca_dl ca_ul ca_comb
_______________________ ______ ______ _______ ________ ________ ________ __________ __________ ___________ ___________ ____________ ____________ __________ _____________ _____________ _____________ _____________ ____________ ____________ ______________ ______________ __________ _____________ _________ _________ ___________ __________ __________ _________________________
2020-12-08 11:48:13.000 14.563 50.035 NaN NaN 0 NaN NaN NaN NaN NaN {0×0 char} {0×0 char} {0×0 char} NaN NaN NaN NaN NaN NaN NaN NaN {0×0 char} {0×0 char } NaN NaN {0×0 char } {0×0 char} {0×0 char} {0×0 char }
2020-12-08 11:48:14.000 14.563 50.035 374 NaN 0 -61 41.49 0.74 9 5 {‘256QAM’} {0×0 char} {0×0 char} 6200 24200 238.43 0.002 238.43 0.327 0 0 {‘TM4’ } {‘MIMO(4×2)’} 10 10 {‘Band 20’} {‘3CA’ } {‘NonCA’ } {‘Band 20+Band 7+Band 3’}
2020-12-08 11:48:15.000 14.563 50.035 374 11 0 -61 43.3 0.7 7 2 {‘256QAM’} {0×0 char} {0×0 char} 6200 24200 256.08 0.002 256.08 0.314 0 0 {‘TM4’ } {‘MIMO(4×2)’} 10 10 {‘Band 20’} {‘3CA’ } {‘NonCA’ } {‘Band 20+Band 7+Band 3’}
2020-12-08 11:48:16.000 14.563 50.035 374 10 0 -61 44.31 0.69 6 2 {‘256QAM’} {0×0 char} {0×0 char} 6200 24200 257.2 0.001 257.2 0.324 0 0 {‘TM4’ } {‘MIMO(4×2)’} 10 10 {‘Band 20’} {‘3CA’ } {‘NonCA’ } {‘Band 20+Band 7+Band 3’}
2020-12-08 11:48:17.000 14.563 50.035 374 10 0 -61 43.57 0.81 6 0 {‘256QAM’} {0×0 char} {0×0 char} 6200 24200 252.94 0.001 252.94 0.357 0 0 {‘TM4’ } {‘MIMO(4×2)’} 10 10 {‘Band 20’} {‘3CA’ } {‘NonCA’ } {‘Band 20+Band 7+Band 3’}
2020-12-08 11:48:18.000 14.563 50.035 374 9 0 -63 44.93 0.79 7 0 {’64QAM’ } {0×0 char} {0×0 char} 6200 24200 226.24 0.002 226.24 0.35 0 0 {‘TM4’ } {‘MIMO(4×2)’} 10 10 {‘Band 20’} {‘3CA’ } {‘NonCA’ } {‘Band 20+Band 7+Band 3’}
2020-12-08 11:48:19.000 14.563 50.035 374 7 0 -62 44.45 0.8 11 0 {’16QAM’ } {0×0 char} {0×0 char} 6200 24200 191.17 0.002 191.17 0.359 0 0 {‘TM4’ } {‘MIMO(4×2)’} 10 10 {‘Band 20’} {‘3CA’ } {‘NonCA’ } {‘Band 20+Band 7+Band 3’}
2020-12-08 11:48:20.000 14.563 50.035 374 2 0 -66 44.18 0.82 12 2 {’16QAM’ } {0×0 char} {0×0 char} 6200 24200 177.6 0.002 177.6 0.372 0 0 {‘TM4’ } {‘MIMO(4×2)’} 10 10 {‘Band 20’} {‘3CA’ } {‘NonCA’ } {‘Band 20+Band 7+Band 3’}
I am using HISTA to find a 20×20 meters grid and applying it on the data sets.
[latbin, lonbin] = hista(w_files{ii}.lat,w_files{ii}.lon,0.0004);% bin at 20x20m,hista binning + computing binsID
[w_files{ii}.latEq, w_files{ii}.lonEq] = grn2eqa(w_files{ii}.lat,w_files{ii}.lon);% Convert coordinates to equidistant cartesian coordinates
[latbinEq, lonbinEq] = grn2eqa(latbin, lonbin);% Convert coordinates to equidistant cartesian coordinates
dist = pdist2([w_files{ii}.lonEq,w_files{ii}.latEq],[lonbinEq, latbinEq]);% Compute distance between each coordinate and each bin-center
[~, w_files{ii}.bin20] = min(dist,[],2);% Add bin ID numbers to table
When I run a figure with plot_google_map I am not getting squares but rectangles. Right now, I am not sure if I am just displaying it wrong or I have made some mistake in the binning. I have added one sample file for you guys to try. (You will need plot_google_map function to have the map picture but this issue is clearly visible without it as well).
figure()
hold on
scatter(lonbin, latbin, 200, 1:numel(lonbin), ‘Marker’,’*’,’LineWidth’,2) % bin centers
scatter(w_files{ii}.lon,w_files{ii}.lat, 50,w_files{ii}.bin20,’filled’)
cmap = colorcube(255);
colormap(cmap(1:end-10,:))
xlabel(‘longitude’); ylabel(‘latitude’)
latbinUnq = unique(latbin);
lonbinUnq = unique(lonbin);
set(gca, ‘xtick’, lonbinUnq(2:end)-diff(lonbinUnq)/2,’ytick’,latbinUnq(2:end)-diff(latbinUnq)/2)
grid on
plot_google_map(‘Scale’,2,’resize’,2,’ShowLabels’,0)%google_plot settings
What do you think? If you think you know the answer, please be very specific because I am a beginner and I might be dumb. Hello everybody!
My data contains latitude, longitute, time and multiple other variables. I need to bin this data for my needs.
>> head(w_files{1})
time lon lat pci_lte sinr_lte cinr_lte rsrp_lte prb_dl_lte prb_ul_lte bler_dl_lte bler_ul_lte mod_dl_0_lte mod_dl_1_lte mod_ul_lte earfnc_dl_lte earfnc_ul_lte tp_mac_dl_lte tp_mac_ul_lte tp_pdsch_lte tp_pusch_lte tp_pdcp_dl_lte tp_pdcp_ul_lte tm tx_rx bw_dl_lte bw_ul_lte band ca_dl ca_ul ca_comb
_______________________ ______ ______ _______ ________ ________ ________ __________ __________ ___________ ___________ ____________ ____________ __________ _____________ _____________ _____________ _____________ ____________ ____________ ______________ ______________ __________ _____________ _________ _________ ___________ __________ __________ _________________________
2020-12-08 11:48:13.000 14.563 50.035 NaN NaN 0 NaN NaN NaN NaN NaN {0×0 char} {0×0 char} {0×0 char} NaN NaN NaN NaN NaN NaN NaN NaN {0×0 char} {0×0 char } NaN NaN {0×0 char } {0×0 char} {0×0 char} {0×0 char }
2020-12-08 11:48:14.000 14.563 50.035 374 NaN 0 -61 41.49 0.74 9 5 {‘256QAM’} {0×0 char} {0×0 char} 6200 24200 238.43 0.002 238.43 0.327 0 0 {‘TM4’ } {‘MIMO(4×2)’} 10 10 {‘Band 20’} {‘3CA’ } {‘NonCA’ } {‘Band 20+Band 7+Band 3’}
2020-12-08 11:48:15.000 14.563 50.035 374 11 0 -61 43.3 0.7 7 2 {‘256QAM’} {0×0 char} {0×0 char} 6200 24200 256.08 0.002 256.08 0.314 0 0 {‘TM4’ } {‘MIMO(4×2)’} 10 10 {‘Band 20’} {‘3CA’ } {‘NonCA’ } {‘Band 20+Band 7+Band 3’}
2020-12-08 11:48:16.000 14.563 50.035 374 10 0 -61 44.31 0.69 6 2 {‘256QAM’} {0×0 char} {0×0 char} 6200 24200 257.2 0.001 257.2 0.324 0 0 {‘TM4’ } {‘MIMO(4×2)’} 10 10 {‘Band 20’} {‘3CA’ } {‘NonCA’ } {‘Band 20+Band 7+Band 3’}
2020-12-08 11:48:17.000 14.563 50.035 374 10 0 -61 43.57 0.81 6 0 {‘256QAM’} {0×0 char} {0×0 char} 6200 24200 252.94 0.001 252.94 0.357 0 0 {‘TM4’ } {‘MIMO(4×2)’} 10 10 {‘Band 20’} {‘3CA’ } {‘NonCA’ } {‘Band 20+Band 7+Band 3’}
2020-12-08 11:48:18.000 14.563 50.035 374 9 0 -63 44.93 0.79 7 0 {’64QAM’ } {0×0 char} {0×0 char} 6200 24200 226.24 0.002 226.24 0.35 0 0 {‘TM4’ } {‘MIMO(4×2)’} 10 10 {‘Band 20’} {‘3CA’ } {‘NonCA’ } {‘Band 20+Band 7+Band 3’}
2020-12-08 11:48:19.000 14.563 50.035 374 7 0 -62 44.45 0.8 11 0 {’16QAM’ } {0×0 char} {0×0 char} 6200 24200 191.17 0.002 191.17 0.359 0 0 {‘TM4’ } {‘MIMO(4×2)’} 10 10 {‘Band 20’} {‘3CA’ } {‘NonCA’ } {‘Band 20+Band 7+Band 3’}
2020-12-08 11:48:20.000 14.563 50.035 374 2 0 -66 44.18 0.82 12 2 {’16QAM’ } {0×0 char} {0×0 char} 6200 24200 177.6 0.002 177.6 0.372 0 0 {‘TM4’ } {‘MIMO(4×2)’} 10 10 {‘Band 20’} {‘3CA’ } {‘NonCA’ } {‘Band 20+Band 7+Band 3’}
I am using HISTA to find a 20×20 meters grid and applying it on the data sets.
[latbin, lonbin] = hista(w_files{ii}.lat,w_files{ii}.lon,0.0004);% bin at 20x20m,hista binning + computing binsID
[w_files{ii}.latEq, w_files{ii}.lonEq] = grn2eqa(w_files{ii}.lat,w_files{ii}.lon);% Convert coordinates to equidistant cartesian coordinates
[latbinEq, lonbinEq] = grn2eqa(latbin, lonbin);% Convert coordinates to equidistant cartesian coordinates
dist = pdist2([w_files{ii}.lonEq,w_files{ii}.latEq],[lonbinEq, latbinEq]);% Compute distance between each coordinate and each bin-center
[~, w_files{ii}.bin20] = min(dist,[],2);% Add bin ID numbers to table
When I run a figure with plot_google_map I am not getting squares but rectangles. Right now, I am not sure if I am just displaying it wrong or I have made some mistake in the binning. I have added one sample file for you guys to try. (You will need plot_google_map function to have the map picture but this issue is clearly visible without it as well).
figure()
hold on
scatter(lonbin, latbin, 200, 1:numel(lonbin), ‘Marker’,’*’,’LineWidth’,2) % bin centers
scatter(w_files{ii}.lon,w_files{ii}.lat, 50,w_files{ii}.bin20,’filled’)
cmap = colorcube(255);
colormap(cmap(1:end-10,:))
xlabel(‘longitude’); ylabel(‘latitude’)
latbinUnq = unique(latbin);
lonbinUnq = unique(lonbin);
set(gca, ‘xtick’, lonbinUnq(2:end)-diff(lonbinUnq)/2,’ytick’,latbinUnq(2:end)-diff(latbinUnq)/2)
grid on
plot_google_map(‘Scale’,2,’resize’,2,’ShowLabels’,0)%google_plot settings
What do you think? If you think you know the answer, please be very specific because I am a beginner and I might be dumb. hista, geographical binning, plotting map MATLAB Answers — New Questions
I want to modify the code to plot the Lagrange polynomial interpolation with Chebyshev points. Map the n+ 1 Chebyshev interpolation points from [-1,1] to [2,3]
clear
n = 3; % the order of the polynomial
a = 2.0; % left end of the interval
b = 3.0; % right end of the interval
h = (b – a)/n; % interpolation grid size
t = a:h:b; % interpolation points
f = 1./t; % f(x) = 1./x, This is the function evaluated at interpolation points
%%%% pn(x) = sum f(t_i)l_i(x)
hh = 0.01; % grid to plot the function both f and p
x = a:hh:b;
fexact = 1./x; %exact function f at x
l = zeros(n+1, length(x)); %%%% l(1,:): l_0(x), …, l(n+1): l_n(x)
nn = ones(n+1, length(x));
d = ones(n + 1, length(x));
for i = 1:n+1
for j = 1:length(x)
nn(i,j) = 1;
d(i,j) = 1;
for k = 1:n+1
if i ~= k
nn(i,j) = nn(i,j) * (x(j) – t(k));
d(i,j) = d(i,j) * (t(i) – t(k));
end
end
l(i,j) = nn(i,j)/d(i,j);
end
end
fapp = zeros(length(x),1);
for j = 1:length(x)
for i=1:n+1
fapp(j) = fapp(j) + f(i)*l(i,j);
end
end
En = 0;
Ed = 0;
for i = 1:length(x)
Ed = Ed + fexact(i)^2;
En = En + (fexact(i) – fapp(i))^2;
end
Ed = sqrt(Ed);
En = sqrt(En);
E = En/Ed;
display(E)
plot(x,fexact,’b*-‘)
hold on
plot(x,fapp,’ro-‘ )clear
n = 3; % the order of the polynomial
a = 2.0; % left end of the interval
b = 3.0; % right end of the interval
h = (b – a)/n; % interpolation grid size
t = a:h:b; % interpolation points
f = 1./t; % f(x) = 1./x, This is the function evaluated at interpolation points
%%%% pn(x) = sum f(t_i)l_i(x)
hh = 0.01; % grid to plot the function both f and p
x = a:hh:b;
fexact = 1./x; %exact function f at x
l = zeros(n+1, length(x)); %%%% l(1,:): l_0(x), …, l(n+1): l_n(x)
nn = ones(n+1, length(x));
d = ones(n + 1, length(x));
for i = 1:n+1
for j = 1:length(x)
nn(i,j) = 1;
d(i,j) = 1;
for k = 1:n+1
if i ~= k
nn(i,j) = nn(i,j) * (x(j) – t(k));
d(i,j) = d(i,j) * (t(i) – t(k));
end
end
l(i,j) = nn(i,j)/d(i,j);
end
end
fapp = zeros(length(x),1);
for j = 1:length(x)
for i=1:n+1
fapp(j) = fapp(j) + f(i)*l(i,j);
end
end
En = 0;
Ed = 0;
for i = 1:length(x)
Ed = Ed + fexact(i)^2;
En = En + (fexact(i) – fapp(i))^2;
end
Ed = sqrt(Ed);
En = sqrt(En);
E = En/Ed;
display(E)
plot(x,fexact,’b*-‘)
hold on
plot(x,fapp,’ro-‘ ) clear
n = 3; % the order of the polynomial
a = 2.0; % left end of the interval
b = 3.0; % right end of the interval
h = (b – a)/n; % interpolation grid size
t = a:h:b; % interpolation points
f = 1./t; % f(x) = 1./x, This is the function evaluated at interpolation points
%%%% pn(x) = sum f(t_i)l_i(x)
hh = 0.01; % grid to plot the function both f and p
x = a:hh:b;
fexact = 1./x; %exact function f at x
l = zeros(n+1, length(x)); %%%% l(1,:): l_0(x), …, l(n+1): l_n(x)
nn = ones(n+1, length(x));
d = ones(n + 1, length(x));
for i = 1:n+1
for j = 1:length(x)
nn(i,j) = 1;
d(i,j) = 1;
for k = 1:n+1
if i ~= k
nn(i,j) = nn(i,j) * (x(j) – t(k));
d(i,j) = d(i,j) * (t(i) – t(k));
end
end
l(i,j) = nn(i,j)/d(i,j);
end
end
fapp = zeros(length(x),1);
for j = 1:length(x)
for i=1:n+1
fapp(j) = fapp(j) + f(i)*l(i,j);
end
end
En = 0;
Ed = 0;
for i = 1:length(x)
Ed = Ed + fexact(i)^2;
En = En + (fexact(i) – fapp(i))^2;
end
Ed = sqrt(Ed);
En = sqrt(En);
E = En/Ed;
display(E)
plot(x,fexact,’b*-‘)
hold on
plot(x,fapp,’ro-‘ ) chebyshev, points MATLAB Answers — New Questions
Simulink Requirement Editor: Indentation of Requirements upon importing them from Excel
I want to import Requirements from an Excel File in the Requirements Editor of Simulink (2018a). I would like to be able to "group", or unfold/collapse requirements according to their topic, as it is shown in the example "Migrating Requirements Management Interface Data to Simulink® Requirements™" (https://ch.mathworks.com/help/slrequirements/examples/_mw_f304f626-0b76-4fbf-a313-1ab233014a0b.html) when requirements are imported from a word file (where apparently Bookmarks are recognized for that).
Is there a way to import requirements from excel, in order to have them in a collapsible structure in the Requirement editor? I have tried the REGEX way where I specified a regex expression for the unique Req IDs (IDs are recognized correctly, i.e. they turn red in the newly opened excel file that appears when pressing "Preview", and after the last item in a line there’s a green item added, which I assume is a line termination item), but the mechanics behind when a new collapsible item is created is a bit shady to me.
Are named Excel cells the way to go? If yes, what’s the strategy?
Thanks for your help!
StefanI want to import Requirements from an Excel File in the Requirements Editor of Simulink (2018a). I would like to be able to "group", or unfold/collapse requirements according to their topic, as it is shown in the example "Migrating Requirements Management Interface Data to Simulink® Requirements™" (https://ch.mathworks.com/help/slrequirements/examples/_mw_f304f626-0b76-4fbf-a313-1ab233014a0b.html) when requirements are imported from a word file (where apparently Bookmarks are recognized for that).
Is there a way to import requirements from excel, in order to have them in a collapsible structure in the Requirement editor? I have tried the REGEX way where I specified a regex expression for the unique Req IDs (IDs are recognized correctly, i.e. they turn red in the newly opened excel file that appears when pressing "Preview", and after the last item in a line there’s a green item added, which I assume is a line termination item), but the mechanics behind when a new collapsible item is created is a bit shady to me.
Are named Excel cells the way to go? If yes, what’s the strategy?
Thanks for your help!
Stefan I want to import Requirements from an Excel File in the Requirements Editor of Simulink (2018a). I would like to be able to "group", or unfold/collapse requirements according to their topic, as it is shown in the example "Migrating Requirements Management Interface Data to Simulink® Requirements™" (https://ch.mathworks.com/help/slrequirements/examples/_mw_f304f626-0b76-4fbf-a313-1ab233014a0b.html) when requirements are imported from a word file (where apparently Bookmarks are recognized for that).
Is there a way to import requirements from excel, in order to have them in a collapsible structure in the Requirement editor? I have tried the REGEX way where I specified a regex expression for the unique Req IDs (IDs are recognized correctly, i.e. they turn red in the newly opened excel file that appears when pressing "Preview", and after the last item in a line there’s a green item added, which I assume is a line termination item), but the mechanics behind when a new collapsible item is created is a bit shady to me.
Are named Excel cells the way to go? If yes, what’s the strategy?
Thanks for your help!
Stefan requiremens editor, simulink, import excel requirements, 2018a, regex MATLAB Answers — New Questions
What are the payment options for Training Classes?
What are the payment options for Training Classes?What are the payment options for Training Classes? What are the payment options for Training Classes? training, payment MATLAB Answers — New Questions
Can I get user email addresses from license server checkout/checkin log?
Hello,
I would like to find a way to get the email address of users of the MATLAB client software whenever they checkout/checkin a software license. Looking at the current software license log for FlexLM, I only see the system name registered for checkout/checkin events. Can you please tell me if there is a way to also include the user’s email address in the log?
Thank you,
-brianHello,
I would like to find a way to get the email address of users of the MATLAB client software whenever they checkout/checkin a software license. Looking at the current software license log for FlexLM, I only see the system name registered for checkout/checkin events. Can you please tell me if there is a way to also include the user’s email address in the log?
Thank you,
-brian Hello,
I would like to find a way to get the email address of users of the MATLAB client software whenever they checkout/checkin a software license. Looking at the current software license log for FlexLM, I only see the system name registered for checkout/checkin events. Can you please tell me if there is a way to also include the user’s email address in the log?
Thank you,
-brian license, checkout, user email MATLAB Answers — New Questions