How to calibrate axis based on point data and extract values.
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi, I have distance data, Dist = [1, 2, 3, 4, 5, 6, 7, 8, 9]. For each distance i know the maximum time value. For Dist = 1, i know the time (10s) and the depth (0.7m). I also know the total time frame which ranges from 1 to 15s. I want to use Dist = 1 point as the calibration point on the y axis. Based on this i want to determine the depth value for each distance based on time and plot(Dist, depth). I have tried this, but how do i link time with depth. Thank you
D = [1, 2, 3, 4, 5, 6, 7, 8, 9];
for D=1;
t=10;
depth=0.7;
plot(D,depth,'r*','MarkerSize',10)
end
1 Commento
HighPhi
il 9 Feb 2022
Modificato: HighPhi
il 9 Feb 2022
I'm not entirely sure what you're trying to do.. but I can at least point out that you're not iterating in your for loop
for D = 1:9
t = 10; % somehow you're supposed to iterate this with respect to dist. idk your equations
depth = 0.7; % but in fact this should be a function of D & t, I'm assuming
plot(D, depth, 'r*','MarkerSize', 10);
hold on % you might want to hold the plot so you don't keep erasing it (should be before for loop but doesn't really matter)
end
Risposte (1)
Image Analyst
il 9 Feb 2022
Modificato: Image Analyst
il 9 Feb 2022
First question: If the time for Dist = 1 is 10 seconds, and the last time, for which you measured Dist(end), is 15 seconds, then how can you say the time ranges from 1 to 15 seconds?
Second question: Why do you think the depth varies at all? You assigned it to 0.7 so why do you think it's not 0.7 for ALL values of time and Dist? Is there some formula or variable that you're not sharing with us?
Here's a better snippet of code, but I still don't know how to change depth because you have not specified that.
D = [1, 2, 3, 4, 5, 6, 7, 8, 9];
t = linspace(10, 15, length(D)) % Time ranges from 10 to 15 with as many elements as D has.\
% Loop over all times or Dist values and set depth.
for k = 1 : length(t)
depth(k) = 0.7;
end
% Plot depth vs. D (Dist).
plot(D, depth, 'r*', 'MarkerSize', 10)
If you already have a plot, as an image, and need to digitize is, see this File Exchange entry by a Mathworker:
0 Commenti
Vedere anche
Categorie
Scopri di più su Loops and Conditional Statements in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
