1

I'm trying to plot a function in python, but every time that I go to test it, it just says:

"plt.plot(t,V)
^
SyntaxError, invalid syntax"

from __future__ import division
import numpy as np
import matplotlib.pyplot as plt
import math

def someFunction(filename, posx, posy, posz):
    //generic code
    //to test 
    //limits...
    data = np.genfromtxt(filename,delimiter=",")
    i = 0
    V = 0
    while i < len(data):
        q = data[i,0]
        x = data[i,1]
        y = data[i,2]
        z = data[i,3]
        r = <some computation>
        V += <some computation>
        i += 1

    return V

def plotFunction(filename):
    V = []
    t = []
    for i in np.arange(0,20,0.1):
        t.append(i)
        V.append(someFunction(filename,i,i**2+2,i-3)
    plt.plot(t,V)
    plt.savefig('plot.pdf')

Any help would be really appreciated.

1 Answer 1

3
V.append(someFunction(filename,i,i**2+2,i-3))

the last closing bracket is missing

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.