function q30=HexInt32toQ30(HexString) % Assume input is int32 but in Q30 format (30 decimal digits) decunnum=hex2dec(HexString); % Q30 format occurs as a multiplication of two Q15 numbers. % The result of the multiplication of two Q15 numbers is a Q30 number with % two sign bits, one of which is redundant. Then, the procedure is first to % remove the redundant sign bit (bit number 31 or MSB) if(decunnum>=2^31);decunnum=decunnum-2^31;end % now perform conversion to signed magnitude remembering that the input is % int32 but assumed as Q30 if(decunnum<2^30) decsignum=decunnum; else decsignum=decunnum-2^31; end % Get those Q30 30 decimal digits q30=decsignum/2^30;