help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: parse error when accessing meshgrid elements


From: Doug Stewart
Subject: Re: parse error when accessing meshgrid elements
Date: Tue, 24 Jun 2014 06:50:42 -0400




On Tue, Jun 24, 2014 at 6:32 AM, rcharan51 <address@hidden> wrote:
this is my code

x=chain(1,1): chain(55,1);
y=-50:50;
[xx,yy]=meshgrid(x,y);
dia=str2num(input('enter the diameter of the shield \n', 's'));
vol=pi*.25*dia^2;
percnt=str2num(input('enter the volume loss in percentage \n', 's'));
vloss=vol*percnt/100;
k=str2num(input('enter the value of k \n', 's'));
z=(vloss/(sqrt(2*pi)*k* getz(xx.))) * exp(-yy.^2/(2* (k*getz(xx.))^2));
surf(x,y,z)


this is the function getz()
function [retval] = getz (input1)
retval=0;
global chain;
for n=1:10;
    j=11-n;
    if input1>=chain(j, 1);
      retval=chain(j, 7);
      break;
    endif
  endfor
endfunction



when i tried to compile the first code i am getting following error

parse error near line 38 of file
C:\Octave\Octave-3.8.1\TUNNELING\tunnelallignment.m

  syntax error

>>> zz=(vloss/(sqrt(2*pi)*k*getz(xx.))) * exp(-yy.^2/(2* (k*getz(xx.))^2));
                                    ^
 please tell me what am i doing wrong




I am not sure where the problem is but I see
global chain
in the function  getz but there is no global chain in your "main" part.
--
DAS


reply via email to

[Prev in Thread] Current Thread [Next in Thread]