Skip to main content
12-Amethyst
Mar 9, 2023 1:42 AM UTC
Solved

Plotting cosine failed, "replace complex values and NaNs by real numbers"

In attached file I'm trying to plot a function of time but am getting a "Replace complex values and NaNs by real numbers".  If I include units in my "t" range definition I can plot my second function.  If I exclude units I can plot my first function.  But not both at same time.  I can't see what is wrong.

 

pic.png

 

 

ttokoro
ttokoroAnswer
21-Topaz I
Mar 9, 2023 3:16 AM UTC

t with unit.  Then bottom plot can make.

image.png

t.t.

7 replies

Werner_E
25-Diamond I
Mar 9, 2023 1:53 AM UTC

Your range for t is defined unitless!

Thats OK with the unitless function v.AB, but in d(t) you use "d0" and "velocity" with correctly assigned units. So you have also to use a range for t with units as otherwise you run into a unit mismatch as you can't add feet and feet/seconds.

Define t:=0s,10^-6 s .. 0.01 s (you have to add a time unit to all three values).

Translate
12-Amethyst
Mar 9, 2023 2:55 AM UTC

Hi Werner,

 

Yes, and as you will see in my attached file, when I do define the units (exactly as you describe), then the bottom plot fails.  How do I correct that?

 

thank you

Translate
ttokoro
ttokoro21-Topaz IAnswer
21-Topaz I
Mar 9, 2023 3:16 AM UTC

t with unit.  Then bottom plot can make.

image.png

Translate
t.t.
18-Opal
Mar 9, 2023 4:32 AM UTC

ppal_0-1678336360268.png

 

Translate
terryhendicott
21-Topaz II
Mar 9, 2023 5:28 AM UTC

Hi,

 

Distance is the integration of velocity.  The velocity varies so you need to do this.

Capture.JPG

Cheers

Terry

Translate
12-Amethyst
Mar 9, 2023 1:21 PM UTC

Hi Terry - in this case my Vab is a voltage, not a distance.  But, thank you.

Translate