hi all ! i wrote this simple function
%
function [ output_args ] = fract_int16( input_args )if input_args<0 output_args=round(2^16+input_args*2^15);else output_args=round(input_args*2^15);endend
when i use it for negative number for exemple
%fract_int16(-0.9133)=35609fract_int16(0.3481)=11409,both values ARE TRUE
but when use this function in an array i get a false value
%
A=[-0.9133 0.3481]fract_int16(A)=[-29927 11407]this is wrong!!
did i make i mistake in writing this function?
thank you all
Best Answer