[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: parse error when accessing meshgrid elements
From: |
Tatsuro MATSUOKA |
Subject: |
Re: parse error when accessing meshgrid elements |
Date: |
Tue, 24 Jun 2014 19:58:04 +0900 (JST) |
----- Original Message -----
> From: rcharan51
> To: help-octave
> Cc:
> Date: 2014/6/24, Tue 19:32
> Subject: parse error when accessing meshgrid elements
>
>t his 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
(vloss/(sqrt(2*pi)*k*getz(xx.))) is a matrix
exp(-yy.^2/(2* (k*getz(xx.))^2)) is a matrix
So the product should be element wise.
(vloss/(sqrt(2*pi)*k*getz(xx.))) . * exp(-yy.^2/(2* (k*getz(xx.))^2));
a dot (.) is missing before '*'.
However I did not test it so that the above is correct.
- Re: parse error when accessing meshgrid elements, (continued)
- Re: parse error when accessing meshgrid elements, c., 2014/06/24
- Re: parse error when accessing meshgrid elements, c., 2014/06/24
- Re: parse error when accessing meshgrid elements, rcharan51, 2014/06/24
- Re: parse error when accessing meshgrid elements, c., 2014/06/24
- Re: parse error when accessing meshgrid elements, rcharan51, 2014/06/25
- Re: parse error when accessing meshgrid elements, c., 2014/06/25
- Re: parse error when accessing meshgrid elements, rcharan51, 2014/06/25
- Re: parse error when accessing meshgrid elements, c., 2014/06/25
- Re: parse error when accessing meshgrid elements, Tatsuro MATSUOKA, 2014/06/25
- Re: parse error when accessing meshgrid elements, rcharan51, 2014/06/25
Re: parse error when accessing meshgrid elements,
Tatsuro MATSUOKA <=
Re: parse error when accessing meshgrid elements, Tatsuro MATSUOKA, 2014/06/24