# Create an equally spaced vector when taking the sine of another vector

5 vues (au cours des 30 derniers jours)
Lama Hamadeh le 17 Juin 2021
Commenté : Lama Hamadeh le 17 Juin 2021
I want to create a vector containing 25 points such that the points are equally spaced when you take the sine of another vector : As shown in the code below:
%angle variable (θ)
theta_min = -pi/2; %minimum angle
theta_max = pi/2; %maximum angle
nt = 25; %number of angles
theta = linspace(theta_min,theta_max,nt); %angle variable
%p=sin(θ)
p = sin(theta); %I want this vector to range from -1 to 1 with 25 equally spaced points.
Thnaks.
##### 0 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

### Réponse acceptée

Stephan le 17 Juin 2021
p_inv = linspace(-1,1,25);
theta = asin(p_inv);
p = sin(theta);
diff(p) % Is p equally spaced?
ans = 1×24
0.0833 0.0833 0.0833 0.0833 0.0833 0.0833 0.0833 0.0833 0.0833 0.0833 0.0833 0.0833 0.0833 0.0833 0.0833 0.0833 0.0833 0.0833 0.0833 0.0833 0.0833 0.0833 0.0833 0.0833
scatter(p,theta)
##### 1 commentaireAfficher -1 commentaires plus anciensMasquer -1 commentaires plus anciens
Lama Hamadeh le 17 Juin 2021
smart move! Thanks!

Connectez-vous pour commenter.

### Catégories

En savoir plus sur Time Series dans Help Center et File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by