0

I have a CSV file in which one column consists of values (class: double) named INV_OutputTorque (89155×1). There are values from -200<x<200 [Nm]. For visualization purposes I want two different colours, one for values of zero and below, and one colour for all other values (positive).

I tried two approaches.

generatorisch = find(INV_OutputTorque <=0)
motorisch = find(INV_OutputTorque > 0)
Plot (INV_Speed, generatorisch, 'g.' ,INV_Speed, motorisch, 'r.');

results in error because Not same length as INV_OutputTorque.

If INV_OutputTorque <= 0, plot ('g.');
Else INV_OutputTorque > 0, plot ('r.');
Endif;

results in error no data to plot.

How can I make this plot?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Dr. X
  • 1
  • 1

1 Answers1

1

The output of find() is an array of indexes. Plotting it directly is not meaningful, you have to use it to extract the subarrays you want to plot.

generatorisch = find(INV_OutputTorque <=0)
motorisch = find(INV_OutputTorque > 0)
Plot (INV_Speed(generatorisch), INV_OutputTorque(generatorisch), 'g.', ...
      INV_Speed(motorisch),     INV_OutputTorque(motorisch),     'r.');
PierU
  • 1,391
  • 3
  • 15