help with Plot a Parametric Equation

4 views (last 30 days)
Hello to everyone, i want some help with maltab code. I have to plot some parametric curves to explain them in the master.
I made these functions.
a,b,c is probability colision,
p=[0,1] , is a FACTOR ACB: access class barring
this is users Na=[1,10000] in p0 sector , Nb=[1,6000] in p1 sector , Nc=[1,3000] in p2 sector.
for the users i use the linspace.
i want the code first of alls to calculates a then calculates p0 and then plot PF in parametric curve. i think i lost it somewhere.
So here is what i have done.

Accepted Answer

Sulaymon Eshkabilov
Sulaymon Eshkabilov on 20 Feb 2023
Edited: Sulaymon Eshkabilov on 20 Feb 2023
Here is a simple example code to get it done:
N = 1e4;
p = linspace(0,1);
Na = linspace(1, 1e4);
Nb = linspace(1, 6e3);
Nc = linspace(1, 3e3);
p0 = @(Na, N)(Na/N);
p1 = @(Nb, N)Nb/N;
a = @(p, Na)(1-(1-p/12).^Na-1);
p0_v = p0(Na,N);
p1_v = p1(Nb,N);
a_v = a(p,Na);
PF = @(p0,a)(a.*(1-(1-a).*p0).^9);
PF_v= PF(p0_v, a_v);
plot(p0_v,PF_v, 'k-', 'linewidth', 2)
xlabel('$p_0(N_a, \ N)$', 'Interpreter','latex')
ylabel('$PF(p_0, \ a)$', 'Interpreter','latex')
grid on
ylim([-1.1 0.1])
  1 Comment
Christos Stergiou
Christos Stergiou on 23 Feb 2023
Edited: Christos Stergiou on 23 Feb 2023
Thank you for your quick answer. I wonder where is the mistake because the probability must be positive, so the y axis must be from 0 until 1.
After 5 mimute i found my mistake, guess i forgot a numeric parenthesis. Everything ok.
Thank you again for your answer, you take me out from a diffucult situation..!

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!