由买买提看人间百态

topics

全部话题 - 话题: linspace
1 (共1页)
l******9
发帖数: 579
1
来自主题: JobHunting版 - ploting 3D surface in python (转载)
【 以下文字转载自 Statistics 讨论区 】
发信人: light009 (light009), 信区: Statistics
标 题: ploting 3D surface in python
发信站: BBS 未名空间站 (Mon Mar 31 16:14:16 2014, 美东)
I would like to make a 3D surfaceplot in python 3.2 by matplotlib on win 7.
My code:
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm
from mpl_toolkits.mplot3d.axes3d import Axes3D
from mpl_toolkits.mplot3d import axes3d
def plotFunc():
x = np.linspace(0.00001,70 ,10) // x is a list of numbers
y = np.linspace(0.01, 7... 阅读全帖
l******9
发帖数: 579
2
来自主题: JobHunting版 - ploting 3D surface in python (转载)
【 以下文字转载自 Statistics 讨论区 】
发信人: light009 (light009), 信区: Statistics
标 题: ploting 3D surface in python
发信站: BBS 未名空间站 (Mon Mar 31 16:14:16 2014, 美东)
I would like to make a 3D surfaceplot in python 3.2 by matplotlib on win 7.
My code:
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm
from mpl_toolkits.mplot3d.axes3d import Axes3D
from mpl_toolkits.mplot3d import axes3d
def plotFunc():
x = np.linspace(0.00001,70 ,10) // x is a list of numbers
y = np.linspace(0.01, 7... 阅读全帖
l******9
发帖数: 579
3
来自主题: Quant版 - ploting 3D surface in python (转载)
【 以下文字转载自 Statistics 讨论区 】
发信人: light009 (light009), 信区: Statistics
标 题: ploting 3D surface in python
发信站: BBS 未名空间站 (Mon Mar 31 16:14:16 2014, 美东)
I would like to make a 3D surfaceplot in python 3.2 by matplotlib on win 7.
My code:
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm
from mpl_toolkits.mplot3d.axes3d import Axes3D
from mpl_toolkits.mplot3d import axes3d
def plotFunc():
x = np.linspace(0.00001,70 ,10) // x is a list of numbers
y = np.linspace(0.01, 7... 阅读全帖
l******9
发帖数: 579
4
来自主题: Statistics版 - ploting 3D surface in python
I would like to make a 3D surfaceplot in python 3.2 by matplotlib on win 7.
My code:
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm
from mpl_toolkits.mplot3d.axes3d import Axes3D
from mpl_toolkits.mplot3d import axes3d
def plotFunc():
x = np.linspace(0.00001,70 ,10) // x is a list of numbers
y = np.linspace(0.01, 70,10)
result = np.linspace(0.01, 70,10)
fig = plt.figure()
ax = fig.gca(projection='3d')
ax.plot_surface(x, y, result, rstride=5, cstride=5, ... 阅读全帖
l******9
发帖数: 579
5
来自主题: _Python版 - ploting 3D surface in python (转载)
【 以下文字转载自 Statistics 讨论区 】
发信人: light009 (light009), 信区: Statistics
标 题: ploting 3D surface in python
发信站: BBS 未名空间站 (Mon Mar 31 16:14:16 2014, 美东)
I would like to make a 3D surfaceplot in python 3.2 by matplotlib on win 7.
My code:
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm
from mpl_toolkits.mplot3d.axes3d import Axes3D
from mpl_toolkits.mplot3d import axes3d
def plotFunc():
x = np.linspace(0.00001,70 ,10) // x is a list of numbers
y = np.linspace(0.01, 7... 阅读全帖
m******t
发帖数: 273
6
【 以下文字转载自 Quant 讨论区 】
发信人: myregmit (myregmit), 信区: Quant
标 题: solve integral eq. embeeded with another integral eq.
发信站: BBS 未名空间站 (Sun Mar 23 14:20:18 2014, 美东)
I need to solve an integral equation embedded with another integral equation
by python 3.2 in win7.
There are 2 integral equations.
The code is here:
import numpy as np
from scipy.optimize.minpack import fsolve
from numpy import exp
from scipy.integrate.quadpack import quad
import matplotlib.pyplot as plt
impor... 阅读全帖
P******e
发帖数: 2223
7
来自主题: Shanghai版 - 大家早
昨捏太兴奋了。
high过头了,一告困到中郎12点半。
但是今早起来想想,侧那,应当是phi=linspace(-pi,pi)个,不是phi=linspace(0,2
*pi), 不过因为是cos, 所以不影响结果形状,嘿嘿。
G*****7
发帖数: 1759
8
function fast_grid_lookup
%% prepare the data
% randomly generate the query points
num_points = 20e6;
points = rand(num_points,2);
% specify the evenly-spaced mesh grid
num_divs = 1028; % per side
num_cells = num_divs^2;
grid_spacing = 1/(num_divs-1);
% you do not have to instantiate the grid points by
% grid = meshgrid(linspace(0, 1, num_div), linspace(0, 1, num_div));
%% find the enclosing cell of each point
tic;
points_in_cell = ceil(points/grid_spacing)+1; % damn you, 1-based matlab
toc;
%% ... 阅读全帖
j****x
发帖数: 222
9
来自主题: Programming版 - 菜鸟请教matlab积分的问题
请教一个关于曲线积分的问题.
x=linspace(-5,5,101);
y=linspace(-5,5,101);
[xx,yy]=meshgrid(x,y);
zz=xx+yy;
pcolor(x,y,zz);
如果我想在x-y平面内画一个半径为3的圆,然后求zz在这条圆线上的积分,该怎么实现
?多谢!
g******s
发帖数: 733
10
程序是这样的,请问怎么把这个圆柱的上下两个平面加上去?怎么用view()看到圆柱的
上表面?
先谢了!
t=linspace(-pi,pi,50);
y=linspace(-1,1,10);
[T,Y]=meshgrid(t,y);
X=sin(T);
Z=cos(T);
surf(X,Y,Z);
axis([-1 1 -1 1 -1 1])
axis off
view([0 -10 300])
m******t
发帖数: 273
11
【 以下文字转载自 Quant 讨论区 】
发信人: myregmit (myregmit), 信区: Quant
标 题: solve integral eq. embeeded with another integral eq.
发信站: BBS 未名空间站 (Sun Mar 23 14:20:18 2014, 美东)
I need to solve an integral equation embedded with another integral equation
by python 3.2 in win7.
There are 2 integral equations.
The code is here:
import numpy as np
from scipy.optimize.minpack import fsolve
from numpy import exp
from scipy.integrate.quadpack import quad
import matplotlib.pyplot as plt
impor... 阅读全帖
m******t
发帖数: 273
12
I need to solve an integral equation embedded with another integral equation
by python 3.2 in win7.
There are 2 integral equations.
The code is here:
import numpy as np
from scipy.optimize.minpack import fsolve
from numpy import exp
from scipy.integrate.quadpack import quad
import matplotlib.pyplot as plt
import sympy as syp
lb = 0
def integrand2(x, a):
print("integrand2 called")
return x**(a-1) * exp(-x)
def integrand1(x, b, c):
print(... 阅读全帖
m******t
发帖数: 273
13
【 以下文字转载自 Quant 讨论区 】
发信人: myregmit (myregmit), 信区: Quant
标 题: solve integral eq. embeeded with another integral eq.
发信站: BBS 未名空间站 (Sun Mar 23 14:20:18 2014, 美东)
I need to solve an integral equation embedded with another integral equation
by python 3.2 in win7.
There are 2 integral equations.
The code is here:
import numpy as np
from scipy.optimize.minpack import fsolve
from numpy import exp
from scipy.integrate.quadpack import quad
import matplotlib.pyplot as plt
impor... 阅读全帖
d*j
发帖数: 756
14
刚刚看了这个链接关于 splinefit的例子:
http://www.mathworks.com/matlabcentral/fileexchange/13812-splin
请教下,里面的break 和 order 是啥意思啊?
就是这个例子里面的:
% x = linspace(0,2*pi,100);
% y = sin(x) + 0.1*randn(size(x));
% % Breaks
% breaks = [0:5,2*pi];
%
% % Fit a spline of order 5
% pp = splinefit(x,y,breaks,5);
%
% % Fit a spline of order 3 with periodic boundary conditions
% pp = splinefit(x,y,breaks,3,'p');
%
% % Constraints: y(0) = 0, y'(0) = 1 and y(3) + y"(3) = 0... 阅读全帖
h******g
发帖数: 11250
15
来自主题: PhotoGear版 - 请教在matlab里面定义等差数列
我拼错了,是linspace,应该有的
你不是律师吗?这些是副业?
a********l
发帖数: 39524
16
来自主题: PhotoGear版 - 请教在matlab里面定义等差数列
linspace it is!某潜水者也说了这个。这就方便多了。多谢。
b*******r
发帖数: 361
17
来自主题: Programming版 - scala 真是一个无法无天的糟货

in R:
> x=seq(-4,4,length=200)
> y=1/sqrt(2*pi)*exp(-x^2/2)
in Python:
> import numpy as np
> x = np.linspace(-4, 4, 200)
> y = 1 / np.sqrt(2 * np.pi) * np.exp(-x ** 2 / 2)
关于后面的人会不会被炸死,这是前面的*人*的问题,不是语言的问题。
z****e
发帖数: 54598
18
来自主题: Programming版 - scala 真是一个无法无天的糟货
你到底看没看前面说的
谁让你import了,那什么语言不能import?
我用apache common math也差不了太多
不过你就算用了import,写出来的代码也还是很难看
这就是python的问题
python本身就是故意弱化各种概念,让外行也能很快上手的半脚本语言
用python本身就是让蠢人也能写代码,这就是你所说人的问题
你跟我来谈import,你确定你跟别人解释import和里面这个np不需要时间?
相比之下,显然是r写得通俗易懂,我不需要谁知道这些语法
它一样看懂这个表达式,基本上就是白话
你的python代码还得解释半天,import,np是什么意思?
linspace什么意思?
解释一下
b*******r
发帖数: 361
19
来自主题: Programming版 - scala 真是一个无法无天的糟货
seq和linspace的功能基本相同,^和**一致。语法来说我喜欢r少一些。有点杂乱。
y**i
发帖数: 44
20
现在需要fsolve解一个非线性方程,单独用另一个子程序m文件定义函数,不过函数的自
变量是一个数组,数组维数我将在主文件用input赋值,就是说,我现在需要在子程序里
面不赋初值的定义一个数组,用linspace和one(n,1)都不可以,也不需要symbolic的计算
,所以不能用syms,
该如何
在线请教各位高手,在下水平低劣,问题幼稚,见笑
感谢先
z***n
发帖数: 3
21
这样貌似可以,和lz一样画两条线,但是只有一个legend
x=linspace(0,2*pi,100);
y=sin(x);
xx=[pi/2,3/2*pi];
yy=sin(xx);
hline=plot(x,y,'b');
hold on
hdots=plot(xx,yy,'r*');
hg=hggroup;
set(hline,'parent',hg);
set(hdots,'parent',hg);
set(get(get(hg,'Annotation'),'LegendInformation'),'IconDisplayStyle','on');
hLegend=legend(hg,'extremes');
b**********l
发帖数: 116
22
假如我simulate一个w=1的正弦信号:
x=linspace(-10,10,200);
y=sin(x);
我想用Matlab看一下在频率谱图里面,w=1那正好有个1的值,其他的频率是0.这个怎么
搞啊?
stem(fftshift(fft(y)))
可以吗?
目的:我有一段音频,比如是64kHz和130kHz混合的,但这两个频率我事先不知道。我
想用Maltab里面的傅立叶变换函数画个图看一下这两个峰值在哪。请问这个怎么搞?
多谢。。。
c*******g
发帖数: 475
23
搞定
clc
filename='c:\Documents and Settings\User Name\My Documents\Spectral File.SPA
';
fid=fopen(filename,'r');
% Find the points number
fseek(fid,hex2dec('234'),'bof');
Number_of_DataPoints=fread(fid,1,'int32');
%Find the maximum and minimum of Wavenumber (cm-1) range
fseek(fid,576,'bof');
Maximum_Wavenumber=fread(fid,1,'single');
Minimum_Wavenumber=fread(fid,1,'single');
Interval=(Maximum_Wavenumber-Minimum_Wavenumber)/(Number_of_DataPoints-1);
Wavenumber=linspace(Minimum_Wavenumber,Maximum_Wa
t******g
发帖数: 1136
24
来自主题: Mathematics版 - 我问关于matlab 画图
自己定义了一个函数,想画出来
用:
x = linspace(1,3,10)
plot(x,fun(x))
画出来了有错!
然后用fplot(@fun,1,3)画确能画出函数图形来!
请问怎么回事?
谢谢
f*****g
发帖数: 83
25
来自主题: Mathematics版 - 初学matlab菜鸟求助
如果 t=linspace(-10,20,301)
如何输入函数f=20exp(-t/10)cos(0.1t+π/3)
我输入>>f=20*exp(-t/10)*cos(0.1*t+pi/3)之后,说我mtime错误。
有朋友知道我错哪里了么,万分感激!!
f*****g
发帖数: 83
26
来自主题: Mathematics版 - 初学matlab菜鸟求助
哦,忘了说了,t=linspace(-10,20,301)
你是不说应该这样输入:>>f=20*exp(-t/10).*cos(0.1*t+pi/3)
感谢你的回复。
y****e
发帖数: 1012
27
来自主题: Mathematics版 - 能问大家几个数值分析的问题吗?
大家过年好~~有几个题目不是很清楚~
给了几段matlab程序,问题问发生了什么问题?
1.
close all
k=0;
n=100;
for delta = [.1 .01 .008 .007 .005 .003 ]
x = linspace(1-delta,1+delta,n)';
y = x.^6 - 6*x.^5 + 15*x.^4 - 20*x.^3 + 15*x.^2 - 6*x + ones(n,1);
k = k+1;
subplot(2,3,k)
plot(x,y,x,zeros(1,n))
axis([1-delta 1+delta -max(abs(y)) max(abs(y))])
end
2.
% p = smallest positive integer so 1+1/2^p = 1.
x=1; p=0; y=1; z=x+y;
while x~=z
y=y/2;
p=p+1;
z=x+y;
end
disp(sprintf('p = %2.0f is the smallest positive ... 阅读全帖
d*j
发帖数: 756
28
刚刚看了这个链接关于 splinefit的例子:
http://www.mathworks.com/matlabcentral/fileexchange/13812-splin
请教下,里面的break 和 order 是啥意思啊?
就是这个例子里面的:
% x = linspace(0,2*pi,100);
% y = sin(x) + 0.1*randn(size(x));
% % Breaks
% breaks = [0:5,2*pi];
%
% % Fit a spline of order 5
% pp = splinefit(x,y,breaks,5);
%
% % Fit a spline of order 3 with periodic boundary conditions
% pp = splinefit(x,y,breaks,3,'p');
%
% % Constraints: y(0) = 0, y'(0) = 1 and y(3) + y"(3) = 0... 阅读全帖
a****o
发帖数: 42
29
who don't you try this:
x=linspace(0,1);
y=x.^2;
figure(1);
plot(x,y);
figure(2);
plot(x,y,'d-');
figure(3);
plot(x,y,'s');
after this, it might be a good idea to type:
help plot
Hope this is what you want
1 (共1页)