CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   MATLAB Streamslice error (https://www.cfd-online.com/Forums/main/112215-matlab-streamslice-error.html)

Hoggs17 January 23, 2013 20:28

MATLAB Streamslice error
 
Greetings all -

I am trying to plot streamlines for my 2-D FVM Matlab code but my scale is not what I'd like it to be (this is more of a MATLAB plotting question rather than a CFD theory question)

My code snippet for the streamslice is as follows.

%%%%%%%%%%%%%%%%%%%%%%%%%%
% Generate Streamline plot
uvect=zeros(nodes_x,nodes_y);
vvect=zeros(nodes_x,nodes_y);
for i=1:nodes_x-1;
for j=1:nodes_y-1;
uvect(i,j)=0.5*(u(i,j)+u(i+1,j));
vvect(i,j)=0.5*(v(i,j)+v(i,j+1));
end
end

figure(5)
[X,Y]=meshgrid(0:x,0:y);
streamslice(X,Y,uvect,vvect);

%%%%%%%%%%%%%%%%%%%%%%%%%%

My plot window goes from 0 to 10 (x and y values) but I want it to go the width and length of my boundary (denoted as width and length). However when change the meshgrid (0:x,0:y) I keep getting an error

Anyone got any ideas? I'm pretty sure I'm just missing but I'm not seeing it. Thanks for reading!

Hoggs


All times are GMT -4. The time now is 15:33.