Tag Archives: matlab
No fullscreen of test sequence and assessment in 2025a
Hello,
actually we switched from 2022b to 2025a a couple of month ago and when I want to make a test harness with a test sequence and a test assessment, it is not possible to increase the window size to full screen on a large monitor. In 2022b it worked. What can I do?Hello,
actually we switched from 2022b to 2025a a couple of month ago and when I want to make a test harness with a test sequence and a test assessment, it is not possible to increase the window size to full screen on a large monitor. In 2022b it worked. What can I do? Hello,
actually we switched from 2022b to 2025a a couple of month ago and when I want to make a test harness with a test sequence and a test assessment, it is not possible to increase the window size to full screen on a large monitor. In 2022b it worked. What can I do? simulink, test sequence, test assessment MATLAB Answers — New Questions
2-d lookup table block codegeneration
my 2d lookup table is set as so.
the generated code from this block is as below.
Even though the input parameter is 8X6 array which should be defined as [0][0],
the generated code defines the input as a 1-dimension array [0].
This results in polyspace defect category "Unreliable cast of pointer"
Is there a way to match the generated code to the parameter’s actual size?my 2d lookup table is set as so.
the generated code from this block is as below.
Even though the input parameter is 8X6 array which should be defined as [0][0],
the generated code defines the input as a 1-dimension array [0].
This results in polyspace defect category "Unreliable cast of pointer"
Is there a way to match the generated code to the parameter’s actual size? my 2d lookup table is set as so.
the generated code from this block is as below.
Even though the input parameter is 8X6 array which should be defined as [0][0],
the generated code defines the input as a 1-dimension array [0].
This results in polyspace defect category "Unreliable cast of pointer"
Is there a way to match the generated code to the parameter’s actual size? code generation MATLAB Answers — New Questions
GPS HDL Reference Applications Overview Not Working
I am working with the GPS HDL reference example from MathWorks:
GPS HDL Reference Applications Overview – MATLAB & Simulink
I am implementing this design on ZCU48DR hardware with the following configuration:
RFDC configured for 4 samples per stream and 5× decimation
Input sample rate: 3922.168 MSPS
After additional decimation, the signal enters the acquisition and tracking IP GPS HDL Acquisition and Tracking Using C/A Code – MATLAB & Simulink at 32.768 MHz
The clock provided to the IP is 196.608 MHz
GPS HDL Acquisition and Tracking Using C/A Code – MATLAB & Simulink, and GPS HDL Data Decode and Position Estimation – MATLAB & Simulink are integrated into a single IP, similar to the reference design
I have also verified the 1 kHz navigation data rate on hardware
Issue:
The acquisition stage works correctly (satellites are detected and tracking is stable)
However, in the decoding stage, frame synchronization fails
This suggests that the LNAV data is not valid
To further debug, I generated an 8-second LNAV signal from the acquisition and tracking HDL model in simulation, but the decoder still fails to decode that LNAV signal.
Questions:
Has this GPS HDL reference example been validated on hardware (particularly ZCU48DR or RFSoC platforms)?
What could cause frame synchronization failure even when acquisition and tracking appear correct?
Could there be an issue with bit alignment, timing, or scaling between tracking output and decoder input?
Is there any recommended method to verify LNAV integrity before decoding?
Any guidance on where to debug this issue would be greatly appreciated.I am working with the GPS HDL reference example from MathWorks:
GPS HDL Reference Applications Overview – MATLAB & Simulink
I am implementing this design on ZCU48DR hardware with the following configuration:
RFDC configured for 4 samples per stream and 5× decimation
Input sample rate: 3922.168 MSPS
After additional decimation, the signal enters the acquisition and tracking IP GPS HDL Acquisition and Tracking Using C/A Code – MATLAB & Simulink at 32.768 MHz
The clock provided to the IP is 196.608 MHz
GPS HDL Acquisition and Tracking Using C/A Code – MATLAB & Simulink, and GPS HDL Data Decode and Position Estimation – MATLAB & Simulink are integrated into a single IP, similar to the reference design
I have also verified the 1 kHz navigation data rate on hardware
Issue:
The acquisition stage works correctly (satellites are detected and tracking is stable)
However, in the decoding stage, frame synchronization fails
This suggests that the LNAV data is not valid
To further debug, I generated an 8-second LNAV signal from the acquisition and tracking HDL model in simulation, but the decoder still fails to decode that LNAV signal.
Questions:
Has this GPS HDL reference example been validated on hardware (particularly ZCU48DR or RFSoC platforms)?
What could cause frame synchronization failure even when acquisition and tracking appear correct?
Could there be an issue with bit alignment, timing, or scaling between tracking output and decoder input?
Is there any recommended method to verify LNAV integrity before decoding?
Any guidance on where to debug this issue would be greatly appreciated. I am working with the GPS HDL reference example from MathWorks:
GPS HDL Reference Applications Overview – MATLAB & Simulink
I am implementing this design on ZCU48DR hardware with the following configuration:
RFDC configured for 4 samples per stream and 5× decimation
Input sample rate: 3922.168 MSPS
After additional decimation, the signal enters the acquisition and tracking IP GPS HDL Acquisition and Tracking Using C/A Code – MATLAB & Simulink at 32.768 MHz
The clock provided to the IP is 196.608 MHz
GPS HDL Acquisition and Tracking Using C/A Code – MATLAB & Simulink, and GPS HDL Data Decode and Position Estimation – MATLAB & Simulink are integrated into a single IP, similar to the reference design
I have also verified the 1 kHz navigation data rate on hardware
Issue:
The acquisition stage works correctly (satellites are detected and tracking is stable)
However, in the decoding stage, frame synchronization fails
This suggests that the LNAV data is not valid
To further debug, I generated an 8-second LNAV signal from the acquisition and tracking HDL model in simulation, but the decoder still fails to decode that LNAV signal.
Questions:
Has this GPS HDL reference example been validated on hardware (particularly ZCU48DR or RFSoC platforms)?
What could cause frame synchronization failure even when acquisition and tracking appear correct?
Could there be an issue with bit alignment, timing, or scaling between tracking output and decoder input?
Is there any recommended method to verify LNAV integrity before decoding?
Any guidance on where to debug this issue would be greatly appreciated. rfsoc, simulink, matlab function, hdl coder, navigation toolbox, satellite communication toolbox, fpga, hdl, c/a code, gps, gnss, vivado MATLAB Answers — New Questions
How to debug test discovery error
In the MATLAB Test Browser, when an error occurs during test discovery (for example while creating test parameters or peforming test class setup), I don’t know how to effectively debug the error or reproduce it in a controlled environment. It just gives me the message and no context, no location or stack info. Adding a breakpoint in the setup code does not help. It does not pause there.
How can I get more information on the error that occurs during test discovery?
This is really frustrating to debug at the moment.In the MATLAB Test Browser, when an error occurs during test discovery (for example while creating test parameters or peforming test class setup), I don’t know how to effectively debug the error or reproduce it in a controlled environment. It just gives me the message and no context, no location or stack info. Adding a breakpoint in the setup code does not help. It does not pause there.
How can I get more information on the error that occurs during test discovery?
This is really frustrating to debug at the moment. In the MATLAB Test Browser, when an error occurs during test discovery (for example while creating test parameters or peforming test class setup), I don’t know how to effectively debug the error or reproduce it in a controlled environment. It just gives me the message and no context, no location or stack info. Adding a breakpoint in the setup code does not help. It does not pause there.
How can I get more information on the error that occurs during test discovery?
This is really frustrating to debug at the moment. test discovery, unittest, test browser MATLAB Answers — New Questions
How to read and write AXI4/AXI4-Lite registers from code generated by Embedded Coder R2025b on a bare-metal MicroBlaze processor?
I have a Simulink model where one part is implemented with Embedded Coder on a bare-metal MicroBlaze soft processor, and another part is implemented with HDL Coder as an IP core that exposes AXI4/AXI4-Lite memory-mapped registers.
How can I read and write those registers from the C code generated by Embedded Coder running on the MicroBlaze?I have a Simulink model where one part is implemented with Embedded Coder on a bare-metal MicroBlaze soft processor, and another part is implemented with HDL Coder as an IP core that exposes AXI4/AXI4-Lite memory-mapped registers.
How can I read and write those registers from the C code generated by Embedded Coder running on the MicroBlaze? I have a Simulink model where one part is implemented with Embedded Coder on a bare-metal MicroBlaze soft processor, and another part is implemented with HDL Coder as an IP core that exposes AXI4/AXI4-Lite memory-mapped registers.
How can I read and write those registers from the C code generated by Embedded Coder running on the MicroBlaze? microblaze, axi4, axi4-lite, bare-metal, memorymappedregisters, devicedriverblocks, tcpclient MATLAB Answers — New Questions
integrate the LTSpice circuit model in MatLab
It´s possible to integrate the LTSpice circuit model in MatLab.
Can LTSpice communicate with Matlab in a simple way, for example with a function in Matlab that writes a text file and LTSPICE executes, and then Matlab reads back the results generated from LTSpice?
Has Matlab a toolbox that can execute SPICE commands directly?It´s possible to integrate the LTSpice circuit model in MatLab.
Can LTSpice communicate with Matlab in a simple way, for example with a function in Matlab that writes a text file and LTSPICE executes, and then Matlab reads back the results generated from LTSpice?
Has Matlab a toolbox that can execute SPICE commands directly? It´s possible to integrate the LTSpice circuit model in MatLab.
Can LTSpice communicate with Matlab in a simple way, for example with a function in Matlab that writes a text file and LTSPICE executes, and then Matlab reads back the results generated from LTSpice?
Has Matlab a toolbox that can execute SPICE commands directly? 10 MATLAB Answers — New Questions
How to unload packages from an Embedded Coder Dictionary in MATLAB R2025b?
I am using Embedded Coder in MATLAB R2025b and unloaded a package from the "Memory Section" tab of the Embedded Coder Dictionary, but it still appears in the "Memory Sections" list.
How can I make sure the package is properly unloaded and removed from the "Memory Sections" list?I am using Embedded Coder in MATLAB R2025b and unloaded a package from the "Memory Section" tab of the Embedded Coder Dictionary, but it still appears in the "Memory Sections" list.
How can I make sure the package is properly unloaded and removed from the "Memory Sections" list? I am using Embedded Coder in MATLAB R2025b and unloaded a package from the "Memory Section" tab of the Embedded Coder Dictionary, but it still appears in the "Memory Sections" list.
How can I make sure the package is properly unloaded and removed from the "Memory Sections" list? embeddedcoderdictionary, unloadpackage, memorysections MATLAB Answers — New Questions
Why is my 2-D array data flattened in code generation from my Simulink model using Embedded Coder but not when I use a Stateflow chart?
I am generating code for my model. When generating code normally, my 2-D array or matrix is flattened as shown below:
var1 = ((&my2DArray[0][0]))[4];
However, when my signals, which are handling the 2-D matrix data, are passed through a Stateflow chart in my model first, the data is represented as a 2-D array even in my generated C-code, as shown below:
var1 = my2DArray[1][2];
Why is my code generated with single indexing for matrices and 2-D arrays, but not when using a Stateflow?I am generating code for my model. When generating code normally, my 2-D array or matrix is flattened as shown below:
var1 = ((&my2DArray[0][0]))[4];
However, when my signals, which are handling the 2-D matrix data, are passed through a Stateflow chart in my model first, the data is represented as a 2-D array even in my generated C-code, as shown below:
var1 = my2DArray[1][2];
Why is my code generated with single indexing for matrices and 2-D arrays, but not when using a Stateflow? I am generating code for my model. When generating code normally, my 2-D array or matrix is flattened as shown below:
var1 = ((&my2DArray[0][0]))[4];
However, when my signals, which are handling the 2-D matrix data, are passed through a Stateflow chart in my model first, the data is represented as a 2-D array even in my generated C-code, as shown below:
var1 = my2DArray[1][2];
Why is my code generated with single indexing for matrices and 2-D arrays, but not when using a Stateflow? flatten, 2d-array, stateflow MATLAB Answers — New Questions
Matlab variable viewer does not update structure variables
I have been saving data in structures and with my version of Matlab (2025B) it does not seem to update these variables in the viewer. I am currently developing some scripts, so I am essentially just running all the code from the command line. I don’t think the code is important; it allocates matrices in a structure based on the data it reads in, and then calculates what the values are. Some psuedo code is below:
NewData=’DataSet_X’;
Data.(NewData).Value=zeros(size(X,1),2);
for I=1:length(X)
[Data.(NewData).Value(I,1),Data.(NewData).Value(I,2)] = ValueCalcFunction(Dataset X, Ith row)
end
Anyway, if I have Data open in the Variables window It shows the Value field as a matrix full of zeros even after it has been updated. If I double click the field and open just it in the variable window, it shows that it has been updated with the correct values. It would be nice to see it in the structure variable… Here is a screen capture that demonstrates what I mean:
Any ideas how can I force a refresh of the variable viewer?
I have a similar problem with the workspace not updating, but I found I can update it by pressing F5 or chosing Refresh from the menu. These options are not available in the variable viewer.
Thanks!I have been saving data in structures and with my version of Matlab (2025B) it does not seem to update these variables in the viewer. I am currently developing some scripts, so I am essentially just running all the code from the command line. I don’t think the code is important; it allocates matrices in a structure based on the data it reads in, and then calculates what the values are. Some psuedo code is below:
NewData=’DataSet_X’;
Data.(NewData).Value=zeros(size(X,1),2);
for I=1:length(X)
[Data.(NewData).Value(I,1),Data.(NewData).Value(I,2)] = ValueCalcFunction(Dataset X, Ith row)
end
Anyway, if I have Data open in the Variables window It shows the Value field as a matrix full of zeros even after it has been updated. If I double click the field and open just it in the variable window, it shows that it has been updated with the correct values. It would be nice to see it in the structure variable… Here is a screen capture that demonstrates what I mean:
Any ideas how can I force a refresh of the variable viewer?
I have a similar problem with the workspace not updating, but I found I can update it by pressing F5 or chosing Refresh from the menu. These options are not available in the variable viewer.
Thanks! I have been saving data in structures and with my version of Matlab (2025B) it does not seem to update these variables in the viewer. I am currently developing some scripts, so I am essentially just running all the code from the command line. I don’t think the code is important; it allocates matrices in a structure based on the data it reads in, and then calculates what the values are. Some psuedo code is below:
NewData=’DataSet_X’;
Data.(NewData).Value=zeros(size(X,1),2);
for I=1:length(X)
[Data.(NewData).Value(I,1),Data.(NewData).Value(I,2)] = ValueCalcFunction(Dataset X, Ith row)
end
Anyway, if I have Data open in the Variables window It shows the Value field as a matrix full of zeros even after it has been updated. If I double click the field and open just it in the variable window, it shows that it has been updated with the correct values. It would be nice to see it in the structure variable… Here is a screen capture that demonstrates what I mean:
Any ideas how can I force a refresh of the variable viewer?
I have a similar problem with the workspace not updating, but I found I can update it by pressing F5 or chosing Refresh from the menu. These options are not available in the variable viewer.
Thanks! variable viewer MATLAB Answers — New Questions
installation error: An attempt to create a new profile for an email address already in use was detected.
I have applied for a trial version and downloaded the installer. During installation, after I input user name and password, the installer showed the "confirm user" page, and then I clicked next step, and then the installer showed an error page: An attempt to create a new profile for an email address already in use was detected. Please help to solve this issue.
Thank you
RickI have applied for a trial version and downloaded the installer. During installation, after I input user name and password, the installer showed the "confirm user" page, and then I clicked next step, and then the installer showed an error page: An attempt to create a new profile for an email address already in use was detected. Please help to solve this issue.
Thank you
Rick I have applied for a trial version and downloaded the installer. During installation, after I input user name and password, the installer showed the "confirm user" page, and then I clicked next step, and then the installer showed an error page: An attempt to create a new profile for an email address already in use was detected. Please help to solve this issue.
Thank you
Rick installation error MATLAB Answers — New Questions
email address aleady in use
when installing the Free trial student version of matlab 2026 i get this error "An attempt to create a new profile for an email address already in use was detected." even though i am not creating a new account , i am using my account that i am signed in on matlab site to download the license how do i fix that problemwhen installing the Free trial student version of matlab 2026 i get this error "An attempt to create a new profile for an email address already in use was detected." even though i am not creating a new account , i am using my account that i am signed in on matlab site to download the license how do i fix that problem when installing the Free trial student version of matlab 2026 i get this error "An attempt to create a new profile for an email address already in use was detected." even though i am not creating a new account , i am using my account that i am signed in on matlab site to download the license how do i fix that problem matlab MATLAB Answers — New Questions
polellip function not working
the polellip function is not working !
I have the antenna toolbox and the phasing array toolbox both in R2026a
need help
thank youthe polellip function is not working !
I have the antenna toolbox and the phasing array toolbox both in R2026a
need help
thank you the polellip function is not working !
I have the antenna toolbox and the phasing array toolbox both in R2026a
need help
thank you phased array toolbox MATLAB Answers — New Questions
matlab installation fail at login account
I cannot login to my matlab using my school account. It always stuck on the step after I login through school portal. I deleted my matlab and try to reinstall, also for a newer version. When I install matlab R2025b, I failed again at the login step. After I login my school portal, it says:
"
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
null
There was an unexpected error (type=null, status=null).
"
Can anyone help me with this?I cannot login to my matlab using my school account. It always stuck on the step after I login through school portal. I deleted my matlab and try to reinstall, also for a newer version. When I install matlab R2025b, I failed again at the login step. After I login my school portal, it says:
"
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
null
There was an unexpected error (type=null, status=null).
"
Can anyone help me with this? I cannot login to my matlab using my school account. It always stuck on the step after I login through school portal. I deleted my matlab and try to reinstall, also for a newer version. When I install matlab R2025b, I failed again at the login step. After I login my school portal, it says:
"
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
null
There was an unexpected error (type=null, status=null).
"
Can anyone help me with this? login, installation MATLAB Answers — New Questions
How do I move a stand alone license from one user to another?
Our business has a standalone license for 2015b that was on the laptop of an employee who retired. I need to move that stand alone license to my laptop. How do I get mathworks to deactive the license on the retired employees laptop and get a license file for my laptop using that license and link it to my account?Our business has a standalone license for 2015b that was on the laptop of an employee who retired. I need to move that stand alone license to my laptop. How do I get mathworks to deactive the license on the retired employees laptop and get a license file for my laptop using that license and link it to my account? Our business has a standalone license for 2015b that was on the laptop of an employee who retired. I need to move that stand alone license to my laptop. How do I get mathworks to deactive the license on the retired employees laptop and get a license file for my laptop using that license and link it to my account? move stand alone license to new user and pc. MATLAB Answers — New Questions
Doubt in solving nested integral
I have a query regarding MATLAB code to plot SOP using analytical expression given by :
where
begin{equation}
begin{aligned}
Theta(u,y,v)
&= frac{1}{A_k(u,y,v)}
exp!left(
frac{lambda_Y lambda_Z}{alpha A_k(u,y,v)}
– A_k(u,y,v)frac{1}{bar{gamma}} right. \
&quad left.
– lambda_U u – lambda_V v
right)
E_1!left(
frac{lambda_Y lambda_Z}{alpha A_k(u,y,v)}
right).
end{aligned}
end{equation}
Here is what i tried for code of SOP (analytical):
% This code is for analytical expression of SOP of user k
clc; clear all; close all;
%% Parameters
lambda_X = 1; % rate parameter of the exponential distribution
lambda_Y = 1;
lambda_Z = 1;
lambda_U = 1;
lambda_V = 1;
alpha = 0.1;
k = 1;
a1 = 0.1;
a2= 0.3;
a3 = 0.6;
a = [a1 a2 a3];
R1 = 0.1; % nearest
R2 = 0.2; % middle
R3 = 0.3; % farthest
R = [R1 R2 R3];
beta = 0.8;
t1 = 1*1e5; % samples
t2 = 1e4;
D = (1 – beta) + beta * sum(a(1:k-1));
SOP_ana = [];
for snr_user_dB = 0:5:80
snr_user = 10^(snr_user_dB/10);
snr_eve_dB = 0; % in dB
snr_eve = 10^(snr_eve_dB/10);
accum = 0;
for iter = 1:t1
% Generate all RVs together
y = exprnd(1/lambda_Y);
u = exprnd(1/lambda_U);
v = exprnd(1/lambda_V);
% Gamma_e
Gamma_e = (beta * a(k) * u) / …
(u*D + alpha*y*v + (1/snr_eve));
% t(u,y,v)
t_val = (2^R(k))*(1 + Gamma_e) – 1;
% A_k
if beta*a(k) – t_val*D <= 0
continue;
end
A_k = (lambda_X * t_val) / (beta*a(k) – t_val*D);
% Theta
arg = (lambda_Y * lambda_Z)/(alpha*A_k);
Theta = (1/A_k) * …
exp(arg – A_k*(1/snr_user) …
– lambda_U*u – lambda_V*v) …
* expint(arg);
accum = accum + Theta;
end
SOP = 1 – (lambda_U * lambda_V * lambda_Y * lambda_Z / alpha) …
* (accum / t1);
SOP_ana = [SOP_ana SOP];
end
snr_axis = 0:5:80;
figure;
%semilogy(snr_axis, SOP_ana, ‘r-o’,’LineWidth’,1.5);
plot(snr_axis, SOP_ana, ‘r-o’,’LineWidth’,1.5);
grid on;
xlabel(‘SNR (dB)’);
ylabel(‘SOP’);
title(‘SOP vs SNR’);
The output of above code should match the simulation of SOP whose code is given by
% This code is for simulation expression of SOP of user k
%clc; clear all; close all;
%% Parameters
lambda_X = 1; % rate parameter of the exponential distribution
lambda_Y = 1;
lambda_Z = 1;
lambda_U = 1;
lambda_V = 1;
alpha = 0.1;
k = 1;
a1 = 0.1;
a2= 0.3;
a3 = 0.6;
a = [a1 a2 a3];
R1 = 0.1; % nearest
R2 = 0.2; % middle
R3 = 0.3; % farthest
R = [R1 R2 R3];
beta = 0.8;
t1 = 10*1e4; % samples
D = (1 – beta) + beta * sum(a(1:k-1));
SOP_sim = []; count = 0;
for snr_user_dB = 0:5:80
snr_user = 10^(snr_user_dB/10);
snr_eve_dB = 0; % in dB
snr_eve = 10^(snr_eve_dB/10);
for iter = 1:t1
X = exprnd(1/lambda_X); % mean is 1/lambda
Y = exprnd(1/lambda_Y);
Z = exprnd(1/lambda_Z);
U = exprnd(1/lambda_U);
V = exprnd(1/lambda_V);
Gamma_k = (beta * a(k) * X) / …
( X * D + alpha * Y * Z + (1/snr_user));
Gamma_e = (beta * a(k) * U) / …
( U * D + alpha * Y * V + (1/snr_eve));
if Gamma_k < ((2^R(k))*(1+Gamma_e)-1)
%if Gamma_k < (2^R(k)-1)
count = count + 1;
end
end
SOP = count / t1;
SOP_sim = [SOP_sim SOP];
count = 0;
end
snr_axis = 0:5:80;
figure;
%semilogy(snr_axis, SOP_sim, ‘r-o’,’LineWidth’,1.5);
plot(snr_axis, SOP_sim, ‘r-o’,’LineWidth’,1.5);
grid on;
xlabel(‘SNR (dB)’);
ylabel(‘SOP’);
title(‘SOP vs SNR’);
I am not getting what wrong i am doing in analytical SOP code…
Any help in this regard is highly appreciatedI have a query regarding MATLAB code to plot SOP using analytical expression given by :
where
begin{equation}
begin{aligned}
Theta(u,y,v)
&= frac{1}{A_k(u,y,v)}
exp!left(
frac{lambda_Y lambda_Z}{alpha A_k(u,y,v)}
– A_k(u,y,v)frac{1}{bar{gamma}} right. \
&quad left.
– lambda_U u – lambda_V v
right)
E_1!left(
frac{lambda_Y lambda_Z}{alpha A_k(u,y,v)}
right).
end{aligned}
end{equation}
Here is what i tried for code of SOP (analytical):
% This code is for analytical expression of SOP of user k
clc; clear all; close all;
%% Parameters
lambda_X = 1; % rate parameter of the exponential distribution
lambda_Y = 1;
lambda_Z = 1;
lambda_U = 1;
lambda_V = 1;
alpha = 0.1;
k = 1;
a1 = 0.1;
a2= 0.3;
a3 = 0.6;
a = [a1 a2 a3];
R1 = 0.1; % nearest
R2 = 0.2; % middle
R3 = 0.3; % farthest
R = [R1 R2 R3];
beta = 0.8;
t1 = 1*1e5; % samples
t2 = 1e4;
D = (1 – beta) + beta * sum(a(1:k-1));
SOP_ana = [];
for snr_user_dB = 0:5:80
snr_user = 10^(snr_user_dB/10);
snr_eve_dB = 0; % in dB
snr_eve = 10^(snr_eve_dB/10);
accum = 0;
for iter = 1:t1
% Generate all RVs together
y = exprnd(1/lambda_Y);
u = exprnd(1/lambda_U);
v = exprnd(1/lambda_V);
% Gamma_e
Gamma_e = (beta * a(k) * u) / …
(u*D + alpha*y*v + (1/snr_eve));
% t(u,y,v)
t_val = (2^R(k))*(1 + Gamma_e) – 1;
% A_k
if beta*a(k) – t_val*D <= 0
continue;
end
A_k = (lambda_X * t_val) / (beta*a(k) – t_val*D);
% Theta
arg = (lambda_Y * lambda_Z)/(alpha*A_k);
Theta = (1/A_k) * …
exp(arg – A_k*(1/snr_user) …
– lambda_U*u – lambda_V*v) …
* expint(arg);
accum = accum + Theta;
end
SOP = 1 – (lambda_U * lambda_V * lambda_Y * lambda_Z / alpha) …
* (accum / t1);
SOP_ana = [SOP_ana SOP];
end
snr_axis = 0:5:80;
figure;
%semilogy(snr_axis, SOP_ana, ‘r-o’,’LineWidth’,1.5);
plot(snr_axis, SOP_ana, ‘r-o’,’LineWidth’,1.5);
grid on;
xlabel(‘SNR (dB)’);
ylabel(‘SOP’);
title(‘SOP vs SNR’);
The output of above code should match the simulation of SOP whose code is given by
% This code is for simulation expression of SOP of user k
%clc; clear all; close all;
%% Parameters
lambda_X = 1; % rate parameter of the exponential distribution
lambda_Y = 1;
lambda_Z = 1;
lambda_U = 1;
lambda_V = 1;
alpha = 0.1;
k = 1;
a1 = 0.1;
a2= 0.3;
a3 = 0.6;
a = [a1 a2 a3];
R1 = 0.1; % nearest
R2 = 0.2; % middle
R3 = 0.3; % farthest
R = [R1 R2 R3];
beta = 0.8;
t1 = 10*1e4; % samples
D = (1 – beta) + beta * sum(a(1:k-1));
SOP_sim = []; count = 0;
for snr_user_dB = 0:5:80
snr_user = 10^(snr_user_dB/10);
snr_eve_dB = 0; % in dB
snr_eve = 10^(snr_eve_dB/10);
for iter = 1:t1
X = exprnd(1/lambda_X); % mean is 1/lambda
Y = exprnd(1/lambda_Y);
Z = exprnd(1/lambda_Z);
U = exprnd(1/lambda_U);
V = exprnd(1/lambda_V);
Gamma_k = (beta * a(k) * X) / …
( X * D + alpha * Y * Z + (1/snr_user));
Gamma_e = (beta * a(k) * U) / …
( U * D + alpha * Y * V + (1/snr_eve));
if Gamma_k < ((2^R(k))*(1+Gamma_e)-1)
%if Gamma_k < (2^R(k)-1)
count = count + 1;
end
end
SOP = count / t1;
SOP_sim = [SOP_sim SOP];
count = 0;
end
snr_axis = 0:5:80;
figure;
%semilogy(snr_axis, SOP_sim, ‘r-o’,’LineWidth’,1.5);
plot(snr_axis, SOP_sim, ‘r-o’,’LineWidth’,1.5);
grid on;
xlabel(‘SNR (dB)’);
ylabel(‘SOP’);
title(‘SOP vs SNR’);
I am not getting what wrong i am doing in analytical SOP code…
Any help in this regard is highly appreciated I have a query regarding MATLAB code to plot SOP using analytical expression given by :
where
begin{equation}
begin{aligned}
Theta(u,y,v)
&= frac{1}{A_k(u,y,v)}
exp!left(
frac{lambda_Y lambda_Z}{alpha A_k(u,y,v)}
– A_k(u,y,v)frac{1}{bar{gamma}} right. \
&quad left.
– lambda_U u – lambda_V v
right)
E_1!left(
frac{lambda_Y lambda_Z}{alpha A_k(u,y,v)}
right).
end{aligned}
end{equation}
Here is what i tried for code of SOP (analytical):
% This code is for analytical expression of SOP of user k
clc; clear all; close all;
%% Parameters
lambda_X = 1; % rate parameter of the exponential distribution
lambda_Y = 1;
lambda_Z = 1;
lambda_U = 1;
lambda_V = 1;
alpha = 0.1;
k = 1;
a1 = 0.1;
a2= 0.3;
a3 = 0.6;
a = [a1 a2 a3];
R1 = 0.1; % nearest
R2 = 0.2; % middle
R3 = 0.3; % farthest
R = [R1 R2 R3];
beta = 0.8;
t1 = 1*1e5; % samples
t2 = 1e4;
D = (1 – beta) + beta * sum(a(1:k-1));
SOP_ana = [];
for snr_user_dB = 0:5:80
snr_user = 10^(snr_user_dB/10);
snr_eve_dB = 0; % in dB
snr_eve = 10^(snr_eve_dB/10);
accum = 0;
for iter = 1:t1
% Generate all RVs together
y = exprnd(1/lambda_Y);
u = exprnd(1/lambda_U);
v = exprnd(1/lambda_V);
% Gamma_e
Gamma_e = (beta * a(k) * u) / …
(u*D + alpha*y*v + (1/snr_eve));
% t(u,y,v)
t_val = (2^R(k))*(1 + Gamma_e) – 1;
% A_k
if beta*a(k) – t_val*D <= 0
continue;
end
A_k = (lambda_X * t_val) / (beta*a(k) – t_val*D);
% Theta
arg = (lambda_Y * lambda_Z)/(alpha*A_k);
Theta = (1/A_k) * …
exp(arg – A_k*(1/snr_user) …
– lambda_U*u – lambda_V*v) …
* expint(arg);
accum = accum + Theta;
end
SOP = 1 – (lambda_U * lambda_V * lambda_Y * lambda_Z / alpha) …
* (accum / t1);
SOP_ana = [SOP_ana SOP];
end
snr_axis = 0:5:80;
figure;
%semilogy(snr_axis, SOP_ana, ‘r-o’,’LineWidth’,1.5);
plot(snr_axis, SOP_ana, ‘r-o’,’LineWidth’,1.5);
grid on;
xlabel(‘SNR (dB)’);
ylabel(‘SOP’);
title(‘SOP vs SNR’);
The output of above code should match the simulation of SOP whose code is given by
% This code is for simulation expression of SOP of user k
%clc; clear all; close all;
%% Parameters
lambda_X = 1; % rate parameter of the exponential distribution
lambda_Y = 1;
lambda_Z = 1;
lambda_U = 1;
lambda_V = 1;
alpha = 0.1;
k = 1;
a1 = 0.1;
a2= 0.3;
a3 = 0.6;
a = [a1 a2 a3];
R1 = 0.1; % nearest
R2 = 0.2; % middle
R3 = 0.3; % farthest
R = [R1 R2 R3];
beta = 0.8;
t1 = 10*1e4; % samples
D = (1 – beta) + beta * sum(a(1:k-1));
SOP_sim = []; count = 0;
for snr_user_dB = 0:5:80
snr_user = 10^(snr_user_dB/10);
snr_eve_dB = 0; % in dB
snr_eve = 10^(snr_eve_dB/10);
for iter = 1:t1
X = exprnd(1/lambda_X); % mean is 1/lambda
Y = exprnd(1/lambda_Y);
Z = exprnd(1/lambda_Z);
U = exprnd(1/lambda_U);
V = exprnd(1/lambda_V);
Gamma_k = (beta * a(k) * X) / …
( X * D + alpha * Y * Z + (1/snr_user));
Gamma_e = (beta * a(k) * U) / …
( U * D + alpha * Y * V + (1/snr_eve));
if Gamma_k < ((2^R(k))*(1+Gamma_e)-1)
%if Gamma_k < (2^R(k)-1)
count = count + 1;
end
end
SOP = count / t1;
SOP_sim = [SOP_sim SOP];
count = 0;
end
snr_axis = 0:5:80;
figure;
%semilogy(snr_axis, SOP_sim, ‘r-o’,’LineWidth’,1.5);
plot(snr_axis, SOP_sim, ‘r-o’,’LineWidth’,1.5);
grid on;
xlabel(‘SNR (dB)’);
ylabel(‘SOP’);
title(‘SOP vs SNR’);
I am not getting what wrong i am doing in analytical SOP code…
Any help in this regard is highly appreciated for loop, mathematics MATLAB Answers — New Questions
rotor side and control of DFIG based wind energy conversion system
I have my system which is DFIG based wind energy conversion system , i need to replace PI controllers in RSC with MPC controllers , is there any idea about how to do it exactly or ready block for it ?I have my system which is DFIG based wind energy conversion system , i need to replace PI controllers in RSC with MPC controllers , is there any idea about how to do it exactly or ready block for it ? I have my system which is DFIG based wind energy conversion system , i need to replace PI controllers in RSC with MPC controllers , is there any idea about how to do it exactly or ready block for it ? simulink, dfig, control, model predective control, power_conversion_control, simulation MATLAB Answers — New Questions
Control System Analysis Techniques course error
In the Time domain section of the course when I use the step function to plot the grpah it keeps saying i am wrong even though it is the exact same code and graph. Those anyone have anny solutions
below is the code
s = tf(‘s’);
quadcopter_ol = 0.04133/(s + 0.01479);
controller = zpk(-5,0,100);
Task 1
step(quadcopter_ol)In the Time domain section of the course when I use the step function to plot the grpah it keeps saying i am wrong even though it is the exact same code and graph. Those anyone have anny solutions
below is the code
s = tf(‘s’);
quadcopter_ol = 0.04133/(s + 0.01479);
controller = zpk(-5,0,100);
Task 1
step(quadcopter_ol) In the Time domain section of the course when I use the step function to plot the grpah it keeps saying i am wrong even though it is the exact same code and graph. Those anyone have anny solutions
below is the code
s = tf(‘s’);
quadcopter_ol = 0.04133/(s + 0.01479);
controller = zpk(-5,0,100);
Task 1
step(quadcopter_ol) control system analysis techniques, time-domain analysis MATLAB Answers — New Questions
How to change the output font of the live script
I tried to output some non-English characters in the live script, such as using disp, but unfortunately I found that none of the possible settings of matlab.fonts could prevent it from using the default font.I tried to output some non-English characters in the live script, such as using disp, but unfortunately I found that none of the possible settings of matlab.fonts could prevent it from using the default font. I tried to output some non-English characters in the live script, such as using disp, but unfortunately I found that none of the possible settings of matlab.fonts could prevent it from using the default font. live script, font, output MATLAB Answers — New Questions
The IMU block does not support continuous sample time inputs
Hello,
I am trying to simulate the behavior of an IMU on a robot in Simulink. As a first step, I tested it on a simpler structure than my final system. However, with the model below, I get the following error:
“The IMU block does not support continuous sample time inputs.”
I tried changing the solver, but it did not resolve the issue.
Would you have any idea what what changes are needed to properly use the IMU block in this context?
Thank you in advance for your help.Hello,
I am trying to simulate the behavior of an IMU on a robot in Simulink. As a first step, I tested it on a simpler structure than my final system. However, with the model below, I get the following error:
“The IMU block does not support continuous sample time inputs.”
I tried changing the solver, but it did not resolve the issue.
Would you have any idea what what changes are needed to properly use the IMU block in this context?
Thank you in advance for your help. Hello,
I am trying to simulate the behavior of an IMU on a robot in Simulink. As a first step, I tested it on a simpler structure than my final system. However, with the model below, I get the following error:
“The IMU block does not support continuous sample time inputs.”
I tried changing the solver, but it did not resolve the issue.
Would you have any idea what what changes are needed to properly use the IMU block in this context?
Thank you in advance for your help. imu, simscape, continuous, discrete MATLAB Answers — New Questions
How do I publish figures as a pdf so that it shows as it does in MATLAB?
% SIMPLE_PLOT Generate a plot with x and y values as a black line, with labels and a title.
x = linspace(0,2*pi,200);
y = sin(x); % example y values
figure(1)
plot(x,y,’k-‘)
xlabel(‘x (radians)’)
ylabel(‘sin(x)’)
title(‘Black Line: Sine Wave’)
grid on
So as you can see when i run this code in MATLAB it runs and outputs corrrectly but when i go to publish it I am left with it looking like this in the Publish_Example.pdf below.
If you could give me any suggestions or solutions on how to fix this problem it would be greatly appreciated. Thank you!% SIMPLE_PLOT Generate a plot with x and y values as a black line, with labels and a title.
x = linspace(0,2*pi,200);
y = sin(x); % example y values
figure(1)
plot(x,y,’k-‘)
xlabel(‘x (radians)’)
ylabel(‘sin(x)’)
title(‘Black Line: Sine Wave’)
grid on
So as you can see when i run this code in MATLAB it runs and outputs corrrectly but when i go to publish it I am left with it looking like this in the Publish_Example.pdf below.
If you could give me any suggestions or solutions on how to fix this problem it would be greatly appreciated. Thank you! % SIMPLE_PLOT Generate a plot with x and y values as a black line, with labels and a title.
x = linspace(0,2*pi,200);
y = sin(x); % example y values
figure(1)
plot(x,y,’k-‘)
xlabel(‘x (radians)’)
ylabel(‘sin(x)’)
title(‘Black Line: Sine Wave’)
grid on
So as you can see when i run this code in MATLAB it runs and outputs corrrectly but when i go to publish it I am left with it looking like this in the Publish_Example.pdf below.
If you could give me any suggestions or solutions on how to fix this problem it would be greatly appreciated. Thank you! publish, figure, pdf MATLAB Answers — New Questions









