how to find Y value in a parametric plot without cursor

2 visualizzazioni (ultimi 30 giorni)
how do i find the value of Y at a specific X position, eg X=1
t= linspace (0,50,10000);
X= (3*t)+ (1/sin(t))
Y= -2*cos(t)

Risposte (1)

Kian Azami
Kian Azami il 6 Ott 2017
To define the X matrix you need to put the "." before the "/" as below:
X= (3*t)+ (1./sin(t));
The Y is the function of t, so if you have the t you can find the value of Y easily.
But if you want to find a particular t so that X will have the value you want you can find the index of t first and then put that t inside the Y function and see the result. For example you want the X between 3 and 3.2, then you need to find the index of t that makes the X to be between 3 and 3.2. Then you put that t inside the Y and you find the value of Y.
idx = find(X >= 3 & X <= 3.2)
Y= -2*cos(t(idx));

Community Treasure Hunt

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

Start Hunting!

Translated by