getting wrong values when coding

조회 수: 6 (최근 30일)
Guan-Yu
Guan-Yu 2014년 10월 2일
답변: Mischa Kim 2014년 10월 2일
Hello,
There may be something wrong of my code that the outcome seems peculiar.
Here is my code.
>> [x,y]=meshgrid(0:0.02:1,0:1:0);
>> u=0*x;
>> v=4*(1*x-(x.^2));
>> quiver(x,y,u,v);
I just want to do vector analysis, and the outcome of v is the same as my expectation; that is,
v =
Columns 1 through 14
0 0.0784 0.1536 0.2256 0.2944 0.3600 0.4224 0.4816 0.5376 0.5904 0.6400 0.6864 0.7296 0.7696
Columns 15 through 28
0.8064 0.8400 0.8704 0.8976 0.9216 0.9424 0.9600 0.9744 0.9856 0.9936 0.9984 _1.0000_ 0.9984 0.9936
Columns 29 through 42
0.9856 0.9744 0.9600 0.9424 0.9216 0.8976 0.8704 0.8400 0.8064 0.7696 0.7296 0.6864 0.6400 0.5904
Columns 43 through 51
0.5376 0.4816 0.4224 0.3600 0.2944 0.2256 0.1536 0.0784 0
======================================================================================
The maximum of v is obviously one. But after graphing(quiver function), it doesn't equal to one. And I just want to know which part of my code is wrong.
Thanks.

답변 (1개)

Mischa Kim
Mischa Kim 2014년 10월 2일
Guan-Yu, use instead
scale = 0;
quiver(x,y,u,v,scale)
This turns off the automatic scaling of the arrows.

카테고리

Help CenterFile Exchange에서 App Building에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by