Skip to main content
12-Amethyst
March 9, 2023
Solved

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

  • March 9, 2023
  • 2 replies
  • 2260 views

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

 

 

Best answer by ttokoro

t with unit.  Then bottom plot can make.

image.png

2 replies

25-Diamond I
March 9, 2023

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).

12-Amethyst
March 9, 2023

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

ttokoro
21-Topaz I
ttokoro21-Topaz IAnswer
21-Topaz I
March 9, 2023

t with unit.  Then bottom plot can make.

image.png

t.t.
18-Opal
March 9, 2023

ppal_0-1678336360268.png

 

21-Topaz II
March 9, 2023

Hi,

 

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

Capture.JPG

Cheers

Terry

12-Amethyst
March 9, 2023

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