Converting a 2d curve into a 3d curve

4 views (last 30 days)
Pruthvi Acharya
Pruthvi Acharya on 8 Jan 2019
Commented: Pruthvi Acharya on 8 Jan 2019
I have plotted a 2d line, x vs y. x is a 1x202 double and so is y. I want to extent the y values into the 3rd diemension. So if I have a kink in my line, i want that extened into the third dimension.
For example:
x = linspace(-2,2,50)
y = x.^2;
[X,Y]= meshgrid(x,y)
Z = X.^2
surf(X,Y,Z)
xlabel('x')
ylabel('y')
zlabel('z')
This will extend 1d plot into a 3d plot.
But however for my plot, I have the x and y values only. I was wondering if there's a way to extend the pointint into the 3rd diemension such that it still retains it's 1d shape

Answers (1)

madhan ravi
madhan ravi on 8 Jan 2019
  4 Comments
Pruthvi Acharya
Pruthvi Acharya on 8 Jan 2019
untitled.jpg
x = [-55,55,165,275,385,495,605,715,825,935,1045,1155,1265,1375,1485,1595,1705,1815,1925,2035,2145,2255,2365,2475,2585,2695,2805,2915,3025,3135,3245,3355,3465,3575,3685,3795,3905,4015,4125,4235,4345,4455,4565,4675,4785,4895,5005,5115,5225,5335,5445,5555,5665,5775,5885,5995,6105,6215,6325,6435,6545,6655,6765,6875,6985,7095,7205,7315,7425,7535,7645,7755,7865,7975,8085,8195,8305,8415,8525,8635,8745,8855,8965,9075,9185,9295,9405,9515,9625,9735,9845,9955,10065,10175,10285,10395,10505,10615,10725,10835,10945,11055,11165,11275,11385,11495,11605,11715,11825,11935,12045,12155,12265,12375,12485,12595,12705,12815,12925,13035,13145,13255,13365,13475,13585,13695,13805,13915,14025,14135,14245,14355,14465,14575,14685,14795,14905,15015,15125,15235,15345,15455,15565,15675,15785,15895,16005,16115,16225,16335,16445,16555,16665,16775,16885,16995,17105,17215,17325,17435,17545,17655,17765,17875,17985,18095,18205,18315,18425,18535,18645,18755,18865,18975,19085,19195,19305,19415,19525,19635,19745,19855,19965,20075,20185,20295,20405,20515,20625,20735,20845,20955,21065,21175,21285,21395,21505,21615,21725,21835,21945,22055]
y = [-27.6732307725082,-28.9090307210668,-31.4039052121426,-33.4729045873744,-33.9983677188368,-30.5786981800481,-28.2282133773087,-27.4435710715028,-27.1451033243011,-26.9163905573407,-26.7542822183331,-26.6959333691912,-26.6722811604863,-26.6554360325922,-26.6410429112662,-26.6265569975770,-26.6100428612099,-26.5899646704495,-26.5657553288375,-26.5373162573312,-26.5046743596980,-26.4677606869459,-26.4266034049677,-26.3811255270303,-26.3311542623744,-26.2762274519646,-26.2165379694902,-26.1515486646568,-26.0809701857999,-26.0047741037599,-25.9226347455002,-25.8343047383720,-25.7394173264064,-25.6376921520399,-25.5288777006470,-25.4128327371481,-25.2899479011210,-25.1605193616577,-25.0242220157262,-24.8816011395395,-24.7328047916633,-24.5782787199670,-24.4183136315294,-24.2531464827495,-24.0830089950701,-23.9082684974709,-23.7293235470762,-23.5467490739902,-23.3609318686176,-23.1715984298751,-22.9794318920366,-22.7845474371536,-22.5872368696734,-22.3879853190968,-22.1875028951692,-22.0084381720378,-21.9723431364704,-22.2002705434682,-22.4855202968289,-22.8192057627429,-23.2082702225352,-23.6634809388961,-24.2036054889269,-24.8636674061224,-25.7170712763440,-26.8457441453049,-28.9194387723383,-30.5813041833620,-46.5034498530411,-41.3133295972875,-33.0893542804124,-31.3131148723425,-31.3439647088026,-31.4434972132016,-31.5426462814474,-31.6544742830927,-31.7831649398042,-31.9408555373809,-32.1333394026200,-32.3655327212292,-32.6434461390838,-32.9743851885738,-33.3675991644228,-33.8343005429151,-34.3871078327478,-35.0364916760845,-35.7814434408621,-36.5949709914620,-37.4307517214913,-38.2650368296653,-39.1996459774320,-40.2749210688806,-41.0770203243750,-41.7972993499310,-42.4599077934818,-43.3265095358907,-45.5833650589344,-52.7639066829573,-63.3269949804245,-62.8403476191564,-50.6420828137320,-44.7487929534043,-43.6786268952736,-43.6600131925581,-43.7380607579579,-43.8409829308095,-43.9673876320295,-44.1147405277434,-44.2870238696355,-44.4866912791705,-44.7168125958136,-44.9799734645657,-45.2778499992813,-45.6146700976785,-45.9889040503059,-46.3962614144407,-46.8262694348046,-47.2556980529763,-47.6556865840651,-48.0057482548097,-48.3164631180488,-48.6073612396059,-48.9126415825275,-49.2601375297288,-49.6667803274347,-50.1380234895862,-50.6723571844559,-51.2725076987871,-52.0784091599997,-52.9197849693780,-53.5799437184470,-54.1771322282248,-54.7241326542632,-55.2286147609748,-55.6956695113760,-56.1302554086304,-56.5563062592763,-57.0379083825677,-57.7643227078743,-59.0456928434126,-61.2408914201049,-64.6537032649136,-69.4307753632708,-75.1462796860133,-77.7018678895027,-64.7607001933146,-55.4381143975895,-53.1959351847353,-53.3045974766442,-53.5599949943012,-53.8427596455031,-54.1545113015269,-54.4855593296503,-54.8239782010641,-55.1633306205936,-55.4942598005415,-55.8089187313104,-56.1047455605821,-56.3881603775203,-56.6781436718264,-57.0052242453237,-57.3831379119615,-57.8220647554164,-58.3214733227150,-58.8743409832530,-59.4829652411903,-60.1311684682938,-60.8082088653135,-61.5148011960445,-62.5169902102050,-63.2121406968905,-63.8071068433487,-64.3406325500538,-64.8292437849834,-65.2774172437745,-65.6806864698392,-66.0588372948772,-66.4104973802743,-66.7394004854931,-67.0467036854950,-67.3274905350996,-67.5940888369147,-67.8469310249526,-68.0924651326693,-68.3405038931225,-68.6038685139078,-68.9211133076620,-69.3243055848288,-69.8431525252430,-70.4884424617869,-71.2416051579646,-72.0846617104136,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,1000]
I want to convert this 1d line into a mesh or a surface plot
Pruthvi Acharya
Pruthvi Acharya on 8 Jan 2019
I dont know how to add the picutre prope;y
untitled.jpg

Sign in to comment.

Categories

Find more on Line Plots in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!