matlab 画渐近线,python – 如何绘制渐近线?

我跟着一个小教程,让我靠近我想要的地方,但它不是那里,我不知道如何用它做下一步.

这是’我目前的数字:

我不知道如何将渐近线绘制到此图中.

我想我需要创建一个名为Y的变量,它是一条垂直线,然后绘制出那条线?我不确定这是否正确

在这种情况下,我如何为渐近线创建线?

编辑

import pylab as pl

import numpy as np

import matplotlib.pyplot as plt

"""

This is all from the tutorial located at :

http://scipy-lectures.github.io/intro/matplotlib/matplotlib.html

"""

pl.figure(figsize=(10, 6), dpi=80)

pl.subplot(1, 1, 1)

X = np.linspace(-5, 5, 500, endpoint=True)

C = (1/X**2)-5

P = X - X - 0.1

pl.xlim(X.min() * 1.1, X.max() * 1.1)

pl.ylim(C.min() * 1.1, C.max() * 1.1)

"""

Alters the position of the axis - moves them to the centre

"""

ax = pl.gca() # gca stands for 'get current axis'

a

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
This function mmasub performs one MMA-iteration, aimed at % solving the nonlinear programming problem: % % Minimize f_0(x) + a_0*z + sum( c_i*y_i + 0.5*d_i*(y_i)^2 ) % subject to f_i(x) - a_i*z - y_i <= 0, i = 1,...,m % xmin_j <= x_j = 0, y_i >= 0, i = 1,...,m %*** INPUT: % % m = The number of general constraints. % n = The number of variables x_j. % iter = Current iteration number ( =1 the first time mmasub is called). % xval = Column vector with the current values of the variables x_j. % xmin = Column vector with the lower bounds for the variables x_j. % xmax = Column vector with the upper bounds for the variables x_j. % xold1 = xval, one iteration ago (provided that iter>1). % xold2 = xval, two iterations ago (provided that iter>2). % f0val = The value of the objective function f_0 at xval. % df0dx = Column vector with the derivatives of the objective function % f_0 with respect to the variables x_j, calculated at xval. % df0dx2 = Column vector with the non-mixed second derivatives of the % objective function f_0 with respect to the variables x_j, % calculated at xval. df0dx2(j) = the second derivative % of f_0 with respect to x_j (twice). % Important note: If second derivatives are not available, % simply let df0dx2 = 0*df0dx. % fval = Column vector with the values of the constraint functions f_i, % calculated at xval. % dfdx = (m x n)-matrix with the derivatives of the constraint functions % f_i with respect to the variables x_j, calculated at xval. % dfdx(i,j) = the derivative of f_i with respect to x_j. % dfdx2 = (m x n)-matrix with the non-mixed second derivatives of the % constraint functions f_i with respect to the variables x_j, % calculated at xval. dfdx2(i,j) = the second derivative % of f_i with respect to x_j (twice). %

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值