Create an equally spaced vector when taking the sine of another vector
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Lama Hamadeh
am 17 Jun. 2021
Kommentiert: Lama Hamadeh
am 17 Jun. 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:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/656300/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/656305/image.png)
%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 Kommentare
Akzeptierte Antwort
Stephan
am 17 Jun. 2021
p_inv = linspace(-1,1,25);
theta = asin(p_inv);
p = sin(theta);
diff(p) % Is p equally spaced?
scatter(p,theta)
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Resizing and Reshaping Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!