0
votes

I am having an issue when trying to plot these two timeseries against each other:

subplot(2,2,3),plot(wrm,Te);title('Speed-Torque curve');
xlabel('wrm [rad/s]');ylabel('Te[Nm]')
axis([-5 10 20 200]);
grid; 

It comes up with the error of

Error using plot
A numeric or double convertible argument is expected

Error in timeseries/plot (line 163)
p = plot(ax,Time,Data,varargin{:});

I have tried changing the "to workspace" variables in simulink from 1x1 double timeseries to arrays and that seems to allow me to plot, but the plot for just Te become incorrect.

All other plots I create, I am unable to follow the format of plot(time,yvariable) as it gives the same error so I have been just using plot(yvariable) which has worked up until now.

Any help would be appreciated. Thanks!

1

1 Answers

0
votes

From your question I don't understand exactly what you are trying to do. If you are trying to plot the data members of the two timeseries objects against each other, use

plot(wrm.Data, Te.Data);

If you are plotting the data members, you of course need to make sure these vectors are the same length. If they are not, you could use something like

Te2 = resample(Te2, wrm.Time);

If you want to plot both against time instead, use

plot(wrm); hold on; plot(Te);

Or, as I like to do:

wrm.plot(); hold on; Te.plot();