| Author |
Extracting Real number only from 6 roots
|
|
| Michael 2005-04-27, 9:01 pm |
| I am trying to extract only the real number from a set of roots. I
dont want the real parts of a complex number. Just the one valid time
value.
I tried help real but that is for complex numbers. Any ideas.
my mfile
t = 0:0.1:100;
velc = -0.907802*t + 88.000000;
velc = velc';
for ii = 1:1001
velc =velc(ii);
ply = [-0.000393 0.012873 -0.159027 0.875055 -2.195467 -2.899670
(88.000000-velc(ii))]
result = roots(ply)
result(ii) = real(result)
end
| |
| the cyclist 2005-04-27, 9:01 pm |
| Michael wrote:
>
>
> I am trying to extract only the real number from a set of roots. I
> dont want the real parts of a complex number.
I think you want the "isreal" command rather than the "real" command.
| |
| Michael 2005-04-27, 9:01 pm |
| I believe the isreal command only tells the make up of the number. I
cant use the real command in my mfile and only have it shown for
demonstrative purposes. I need a command to pull out the sole real
number and not any real part of a complex number. Thanks
| |
|
| Michael:
<SNIP what's real - what's wrong...
....with
% loop
res(ii)=result(real(result)==result)
% loop
us
|
|
|
|