# Help with creating a 3d surface using a complex formula

Hi guys,

I have made the move from matlab to plotly, and I am trying to create a 3d surface from a complex equation.

Below is what I have so far, but here’s what I want. I want to graph a formula which is essentially based on other formulas which are graphed at different ranges of y value. Kinda like this:

Formula 1 = x
Formula 2 = x^2
Formula 3 = x*3

Main formula = formula 1 (from y = 0 to 4) + formula 2 (from y = 4 to 7) + formula 3 (from y = 7 to 10)

Any thoughts on how I can do this?

Here’s what I have so far:

``````from plotly import __version__
from plotly.graph_objs import *
#import plotly.plotly as py
#import plotly.graph_objs as go
from plotly import tools

import numpy as np
init_notebook_mode()

x = np.linspace(0, 10, 40)
y = np.linspace(0, 10, 40)
xGrid, yGrid = np.meshgrid(y, x)
z = xGrid ** 1 + yGrid ** 1

scene = dict(
xaxis=dict(
gridcolor='rgb(255, 255, 255)',
zerolinecolor='rgb(255, 255, 255)',
showbackground=True,
backgroundcolor='rgb(230, 230,230)'
),
yaxis=dict(
gridcolor='rgb(255, 255, 255)',
zerolinecolor='rgb(255, 255, 255)',
showbackground=True,
backgroundcolor='rgb(230, 230,230)'
),
zaxis=dict(
gridcolor='rgb(255, 255, 255)',
zerolinecolor='rgb(255, 255, 255)',
showbackground=True,
backgroundcolor='rgb(230, 230,230)'
)
)

fig = tools.make_subplots(rows=1, cols=1,
specs=[[{'is_3d': True}]])