MATLAB Matlab Symbolic toolbox question, 'exp' and vector elements

I have a piece of code which near its end needs to do the following task: Given a vector V=(log(A),log(B),log(C)) that has been previously generated[I've used 'log' as opposed to ln here because the 'log' function in matlab is the natural logarithm], I need to find sum(A,B,C). NOT sum(log(A),log(B),log(C))=log(A*B*C), but sum(A,B,C). However, log(A),log(B) and log(C) are each large negative numbers (log(A)=-6126.9,log(B)=-4371.2,log(C)=-2942.1) When I use exp the results are rounded to zero. This is a problem, because the next step in the code is log(D), where D=sum(A,B,C), and log(0)=-Inf (I have a good reason for going from log to exp and back again). I can use the symbolic math toolbox to get the precision I need so that the results for using 'exp' are very small numbers instead of being rounded to 0. However, I don't know how to put this inside my code, i.e. when I type k=sym('exp(v(1,1))') in the matlab command window, it returns k=exp(v(1,1)) as opposed to the value 1.3217180682567377112866860751447*10^(-2661), which is what I get when I do k=sym('exp(-6126.9)'). How can I use sym('exp()') with a particular element of a vector so that I can put this in my code? I'm new to matlab, and if part of the problem is I'm trying to use a tool without understanding how it works, well, learning is exactly why I am at this forum. Thank you very much to anyone who has any advice.

Want to reply to this thread?

"Matlab Symbolic toolbox question, 'exp' and vector elements" You must log in or register to reply here.

Physics Forums Values

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving