Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6759175
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:54:11+00:00 2026-05-26T13:54:11+00:00

Right, so I’ve got a list of x values, y values and z values

  • 0

Right, so I’ve got a list of x values, y values and z values (which I think I converted into arrays?) which I want to make a surface plot, but it’s not working.

Here’s what I’m trying to do, you can ignore most of the code as it is pretty irrelevant – just look at the end where I have xdis, ydis and dist and where I’m trying to plot atm I’m getting ValueError: need more than 1 value to unpack :(. Help much appreciated.

from math import *
from numpy import *
import pylab
def sweep (v,p,q,r,s):
    a=.98

    for i in range (1, len(v)-1):
        for j in range (1, len(v)-1):
            c =0.0

            if i==p and j==q: c =1.0
            if i==r and j==s: c= -1.0
            v[i,j]=(v[i -1,j]+v[i+1,j]+v[i,j -1]+v[i,j+1]+c-a*v[i,j])/(4-a)

def main():
    from mpl_toolkits.mplot3d import Axes3D
    from matplotlib import cm
    from matplotlib.ticker import LinearLocator, FormatStrFormatter
    import matplotlib.pyplot as plt
    ydis=[]
    xdis=[]
    resis=[]
    for j in range(2,18):
        for i in range(2,18):
            v= zeros ((20,20),float )
            p=q=9
            r=i
            s=j
            dv =1.0e10
            lastdv =0
            count =0
            while (fabs(dv - lastdv)>1.0e-7*fabs(dv)):
                lastdv =dv
                sweep(v,p,q,r,s)
                dv=v[p,q]-v[r,s]
            resis.append(dv)
            xdis.append(r-p)
            ydis.append(s-q)

    X=array(xdis)
    Y=array(ydis)
    Z=array(resis)
    fig = plt.figure()
    ax = fig.add_subplot(111, projection='3d')
    ax.plot_wireframe(X,Y,Z)
    plt.show()
main()
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T13:54:12+00:00Added an answer on May 26, 2026 at 1:54 pm

    plot_wireframe expects three 2D-arrays (X,Y,Z) as input. So,

    after:

    X=np.array(xdis)
    Y=np.array(ydis)
    Z=np.array(resis)
    

    add:

    X=X.reshape((-1,16))
    Y=Y.reshape((-1,16))
    Z=Z.reshape((-1,16))        
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Right now I have this SQL query which is valid but always times out:
Right, I've got a slight problem here, in which I've attempted to implement a
Right, i'm new to PHP and mySQL, but i've got a few questions that
Right below the start of the <body> tag, I want to include a script
this is what i have right now Drawing an RSS feed into the php,
Right now I have an application that loads a bunch of thumbnail images into
Right now I am working on c# windows applications developement. But my concern is
Right now I want to store a text file that goes like this: 1
Right now I am working on a multiselect list in MVC 3. I was
Right now I can set a specific length, or a range, but not two

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.