Joe,
Thanks! I stillhave a lot to learn since I have never used Matlab
before, and the only other math software I have used was MathCAD. I
think I need to take the time to run through some tutorials and such.
Jason
On 1/17/2010 7:57 PM, Joe Craig wrote:
The code that you posted doesn't do what you think it does
...
Look at "a" after your code runs. a is a 1x1 matrix.
You need to organize the code so that the swr is computed once for each
element of x, and the result needs to be returned in a vector that has
the same dimensions as a.
Perhaps this will make more sense if you try replacing your swr formula
with something like x^2. If you write
a = x^2
You will get an error.
If you write
a = x.^2
You get a vector that has, element by element, the square of each
element in x.
It is a bit more complicated with your swr formula because it is a more
complicated formula ...
You can use a vector x, and execute my code one line at a time to see
how it is working.
Joe
On Sun, Jan 17, 2010 at 7:46 PM, Jason
Martin <address@hidden>
wrote:
So essentially it is because
I am dumping the whole formula at once?
On 1/17/2010 7:35 PM, Joe Craig wrote:
You need to create the SWR function to
calculate the swr
element by element of x. I'm not quite sure that I got it right, but
... something like this (and I hope that someone will correct my
uneducated attempt at this):
function retswr = swr(x)
tt=tan( pi*x/2);
num = 25+j*35.36*tt;
den = 35.36+j*25*tt;
r = abs(num./den);
retswr = (1+r)./(1-r);
endfunction
Then you can do:
x = linspace (-10, 10, 500);
y = swr(x);
plot(x,y)
Joe
On Sun, Jan 17, 2010 at 6:09 PM, Jason
Martin <address@hidden>
wrote:
Søren,
I changed it to 500, but a still yields a single value.
Jason
On 1/17/2010 5:57 PM, Søren Hauberg wrote:
> søn, 17 01 2010 kl. 17:42 -0500, skrev Jason Martin:
>
>> x=linspace(-10,10,1);
>>
> This line of code generates one point (the last argument is one).
Try
> changing it to
>
> x = linspace (-10, 10, 500);
>
> instead. That might make a difference.
>
> Søren
>
>
>
_______________________________________________
Help-octave mailing list
address@hidden
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
|