f=[ 2 -5 5 5] the normalized, regularly rounded representation of 0.653 is: in matlab

You can use the round function in Matlab to round a number to the nearest integer, and then divide it by the largest absolute value in the given vector. Here's how you can do it:

main.m
f = [2, -5, 5, 5];
num = 0.653;
rounded_num = round(num * max(abs(f)));
normalized_num = rounded_num / max(abs(f));
116 chars
5 lines

This code will give you the normalized, regularly rounded representation of 0.653 according to the given vector f.

related categories

gistlibby LogSnag