Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help with 3d plot!!!

Status
Not open for further replies.

blp82

Electrical
Joined
May 19, 2006
Messages
1
Location
CH
Hi everybody!
here is my problem

I have two matix 3rows x 120cols (foto1 and foto2).

I need to plot this function (axes a, b, y)

y=exp(-disab/100);

knowing that:

disab=((va(1,1)-vb(1,1))^2+(va(1,2)-vb(1,2))^2+(va(1,3)-vb(1,3))^2);

where va and vb are two vector 1x3:

va=[foto1(3,a-1) foto1(3,a) foto1(3,a+1)];
vb=[foto2(3,b-1) foto2(3,b) foto2(3,b+1)];

and axes a and b are 1:1:120


I have tried the following code:

[ a, b ] = meshgrid(1 : 1 : 120);

va=[foto1(3,a-1) foto1(3,a) foto1(3,a+1)];
vb=[foto2(3,b-1) foto2(3,b) foto2(3,b+1)];

disab=((va(1,1)-vb(1,1))^2+(va(1,2)-vb(1,2))^2+(va(1,3)-vb(1,3))^2);

y=exp(-(disab));

mesh(a,b,y);

but it doesn't work, I got this error:
Subscript indices must either be real positive integers or logicals.

How can I solve my problem???
Thankyou so much for your help!

blp
 
are you sure you got this massage from the function here and not from the foto function?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top