help with Plot a Parametric Equation

조회 수: 5 (최근 30일)
Christos Stergiou
Christos Stergiou 2023년 2월 20일
편집: Christos Stergiou 2023년 2월 23일
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.

채택된 답변

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2023년 2월 20일
편집: Sulaymon Eshkabilov 2023년 2월 20일
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
Christos Stergiou
Christos Stergiou 2023년 2월 23일
편집: Christos Stergiou 2023년 2월 23일
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..!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Particle & Nuclear Physics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by