Understanding Symbolic Math in MATLAB: Real and Imaginary Parts

AI Thread Summary
In MATLAB, when using symbolic math, the imaginary unit is represented as 'sqrt(-1)' instead of 'i' in expressions. This occurs because MATLAB defaults to using 'sqrt(-1)' for clarity in symbolic computations. To extract the real part of an expression, the command 'real(ans)' returns the expression with 'sqrt(-1)' still present, indicating that the output retains the symbolic form. Users seeking to simplify the expression or convert it to a numerical form may need to apply additional functions or methods. Understanding these nuances is crucial for effective symbolic math manipulation in MATLAB.
zhaniko93
Messages
13
Reaction score
0
I have such MATLAB problem: I create variables R1 RF R2 and w so:
Code:
syms RF R1 R2 w
then I write expression:
Code:
3*R1*w*(RF + 200)/((R2*w*29*i + 3)*(3*R1*w - 2*i))
which gives:
Code:
(3*R1*w*(RF + 200))/((3*R1*w - 2*sqrt(-1))*(R2*w*29*sqrt(-1) + 3))
why sqrt(-1) and not i? furthermore? if I want real part of the expression and write:
Code:
real(ans)
it gives:
Code:
3*real((R1*w*(RF + 200))/((3*R1*w - 2*sqrt(-1))*(R2*w*29*sqrt(-1) + 3)))
can anyone please help me??
 
Physics news on Phys.org
anybody please
 
Kindly see the attached pdf. My attempt to solve it, is in it. I'm wondering if my solution is right. My idea is this: At any point of time, the ball may be assumed to be at an incline which is at an angle of θ(kindly see both the pics in the pdf file). The value of θ will continuously change and so will the value of friction. I'm not able to figure out, why my solution is wrong, if it is wrong .
TL;DR Summary: I came across this question from a Sri Lankan A-level textbook. Question - An ice cube with a length of 10 cm is immersed in water at 0 °C. An observer observes the ice cube from the water, and it seems to be 7.75 cm long. If the refractive index of water is 4/3, find the height of the ice cube immersed in the water. I could not understand how the apparent height of the ice cube in the water depends on the height of the ice cube immersed in the water. Does anyone have an...
Back
Top