How to plot surf or imagesc for my data?

조회 수: 11 (최근 30일)
Nisar Ahmed
Nisar Ahmed 2021년 8월 13일
댓글: Nisar Ahmed 2021년 8월 27일
Hi,
This is my figure code, it comprises on 38 VP vs TWT plots as:
h = plot(VP1,TWT1,VP2+500,TWT2,VP3+1000,TWT3,VP4+1500,TWT4,VP5+2000,TWT5,VP6+2500,TWT6,...
VP7+3000,TWT7,VP8+3500,TWT8,VP9+4100,TWT9,VP10+4500,TWT10,VP11+5000,TWT11,VP12+5500,...
TWT12,VP13+6000,TWT13,VP14+6500,TWT14,VP15+7000,TWT15,VP16+7500,TWT16,VP17+8000,TWT17,...
VP18+8500,TWT18,VP19+9000,TWT19,VP20+9500,TWT20,VP21+10000,TWT21,VP22+10500,TWT22,...
VP23+11000,TWT23,VP24+11500,TWT24,VP25+12500,TWT25,VP26+13000,TWT26,VP27+13500,TWT27...
,VP28+14000,TWT28,VP29+14500,TWT29,VP30+15000,TWT30,VP31+15500,TWT31,VP32+16000,TWT32,...
VP33+16500,TWT33,VP34+17000,TWT34,VP34+17500,TWT34,VP35+18000,TWT35,VP36+18500,TWT36...
,VP37+19000,TWT37,VP38+19500,TWT38);
I want to to plot it as imagesc rather than vertical curves. How can I do it?
  댓글 수: 9
Nisar Ahmed
Nisar Ahmed 2021년 8월 26일
@Walter Roberson thank you,
I have Z as distance (d) and I am generating it know. So plot like imagesc, can I make a matrix like
vp = [VP1 VP2 VP3 VP4 VP5 VP6 VP7.....]
Nisar Ahmed
Nisar Ahmed 2021년 8월 27일
Now I have z file as well. Please see the attached data:
I want to plot imagesc(d, TWTi, vp). I mean TWTi along y axis and is common for all vp curves. while d is the distance between each vp curve.
Can you please help me to produce a figure.

댓글을 달려면 로그인하십시오.

답변 (1개)

Walter Roberson
Walter Roberson 2021년 8월 13일
Use the Computer Vision insertShape() function to "draw" the lines into an array. Afterwards you can image() the resulting array.
imagesc() is not really suitable for this situation: you would be storing colored pixels into the array, not relative values.
Perhaps I am misunderstanding what kind of plot you were looking for ??
If your primary purpose is just display, then I would not recommend going through the trouble of doing the insertShape -- not unless you are building an image to display on a Raspberry Pi display or to store into a file.
  댓글 수: 4
Nisar Ahmed
Nisar Ahmed 2021년 8월 16일
When I tried to run your code, following error appears
Error using griddedInterpolant
The grid vectors must contain unique points.
Error in interp1 (line 151)
F = griddedInterpolant(X,V,method);
Error in Real_data_inversion>@(v,t)interp1(v,t,VP_lin)
Error in Real_data_inversion (line 211)
TWTs_interp = cellfun(@(v,t) interp1(v,t,VP_lin), VPs(:), TWTs(:), 'uniform', 0);
Walter Roberson
Walter Roberson 2021년 8월 16일
At least one of your VP* variables contains duplicate points; perhaps the line doubles back on itself.
In that situation, I am having trouble imagining what result you are hoping for.

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by