Finding the Y value corresponding to X value in a parametric plot
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Joseph Lee
am 5 Okt. 2017
Kommentiert: Joseph Lee
am 12 Okt. 2017
how do i find the value of Y when X= 1360 for every loop? X and Y gives a matrix. s is a random number for each loop
smax=0.4;
smin=0.1;
S=smin+rand(1,n)*(smax-smin);
S_cumulative=cumsum(S);
n= 3200;
R=200.04;
V=30;
v=20000;
i=1;
while i<n
t= linspace (0,50,100000);
X=R*sind((v*t/(R))+(V*(t))+S_cumulative(i);
Y=-R*cosd((v*t/R));
end
i=i+1;
2 Kommentare
Akzeptierte Antwort
KL
am 5 Okt. 2017
Bearbeitet: KL
am 5 Okt. 2017
If all your curves have the same timestep and same number of measurements why not put them all together in a matrix and then find the minimum? For example,
allY = rand(10,4); %say, you have 4 curves with 10 values (random data in this example)
X = (1:10)';
data_summary = [X allY] %put them together
intvl = 3:6; %in your case 1360 to 1400
minVals = min(data_summary(intvl,2:end))
7 Kommentare
KL
am 11 Okt. 2017
As far as I have understood, every column of the Y matrix is a curve and they are somehow associated with X along the row. So when I say find minimum value of Y when X = 6 (for example), we are trying to find the minimum along the row 6 across all columns (hence along all curves).
You're saying there are 100000 values of y for each iteration (or curve), well that means 100000 x, right? How about storing it vertically?
X Y1
1 0.4
2 0.2
... ...
100000 0.34
and then concatenate it horizontally for the next iteration,
X Y1 Y2
1 0.4 0.8
2 0.2 0.4
... ... ...
100000 0.34 0.1
So, this how I could understand the problem from your descriptions. This is why we insist on creating a minimal example with a sample code.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Creating and Concatenating 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!