How do I store larger and smaller values in a matrix?
Show older comments
Hi!
I made a small code and found out that when making calculations in my matrix some values approximates to zero as a result of other large numbers. Is there some general way of managing this? Here's my code:
R = 100;
C = 10^-9;
R3 = 100;
R2 = ones(3,1).*R3.*sqrt(2)
R2(1) = 1 *R2(1); %Equal complex and real part
R2(2) = 0.95 *R2(2); %Larger complex than real part
R2(3) = 1.05 *R2(3); %Smaller complex than real part
R4 = 100;
R5 = 100;
G = R5/R4;
k = G/(R*C);
%Transfer fucntion numerator and denumerator
denum = ones(3,3);
for i = 1:3
denum(i,:) = [1, k.*R2(i)./R3, k^2]
end
You will se that all rows in denum's first column will become 0 as k^2 is large. Even though the first column should have ones in it.
I know I can but in ones later on, but I have ones there for the simplicity of explaining the problem.
Accepted Answer
More Answers (0)
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!