How to generate random variable theta for F(theta)=N(1 - (mu*B)/(k*​T)*cos(the​ta)). For N=1 and mu*B/k*T=0.01

2 vues (au cours des 30 derniers jours)
Hello everyone,
Im trying to generate random theta numbers from a uniform distribution (Inverse Tranformation Method), my equation F(theta)=N(1 - (mu*B)/(k*T)*cos(theta)) is called Boltzmann Distribution. I will be happy If someone can help me! the Figure I should get, looks like this
  2 commentaires
Dyuman Joshi
Dyuman Joshi le 22 Juil 2022
Looks like a fairly simple graph. What have you tried yet?
If you have not tried anything, start with plot
Souhail
Souhail le 22 Juil 2022
@Dyuman Joshi Thank you for you reply, I already tried to plot it, but its not that easy, when I plot it I dont get the desire graph

Connectez-vous pour commenter.

Réponses (2)

Dyuman Joshi
Dyuman Joshi le 22 Juil 2022
syms theta
fplot(1-0.01*cosd(theta))
xlim([0 180])
ylim([0.99 1.015])

Walter Roberson
Walter Roberson le 22 Juil 2022
Modifié(e) : Walter Roberson le 22 Juil 2022
syms mu B k T theta
f(theta) = 1 - (mu*B)/(k*T)*cosd(theta)
f(theta) = 
x = rand(1,5) * 180
x = 1×5
155.8450 168.7684 129.4596 95.2868 64.1594
f(x)
ans = 
vpa(ans)
ans = 
  2 commentaires
Souhail
Souhail le 22 Juil 2022
@Walter Roberson thank you for you help, but when I plot it I don't get the plots which I desire, I don't know why !
Walter Roberson
Walter Roberson le 22 Juil 2022
In the code I posted, you would not be able to plot until you had substituted in actual values for the variables such as B mu T k

Connectez-vous pour commenter.

Catégories

En savoir plus sur Discrete Data Plots dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by