开发者

realtime plotting in matlab using SURF

i want to plot a 3d graph using surf in matlab. i know how to plot it just using surf:

k = 5;
n = 2^k-1;
[x,y,z] = sphere(n);
c = hadamard(2^k);
p=surf(x,y,z);

but i want to plot this in realtime, and i want to update the values using set. I tired:set(p,"XData",Xvalue,"YData",Yvalue,"ZData",Zvalue); but its 开发者_如何学Cgiving me errors. has anyone plotted using surf in realtime?


1) you can use the linkdata command or toolbar button (or even Tools -> Link from the plot window)

2) programmatically: you need to call the command 'refreshdata' to signal that new data is available:

%% Define the data
t=linspace(0,2*pi,40);
y=sin(t);

%% Create the plot and set teh datasources
h=plot(t,y)
set(h,'YDataSource','y')
set(h,'XDataSource','t')

%% Now update the data and the plot
pause
y=sin(2*t);
refreshdata

This shows it for the plot, but expect surf will behave the same.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜