How to set period (t=0 becomes t=-4)

8 Ansichten (letzte 30 Tage)
NS
NS am 15 Apr. 2016
Kommentiert: NS am 18 Apr. 2016
I'm creating graphs in Matlab for a relative simple equation. I want the value that is the first value in my input matrix to be 'recognized' as belonging to t=-4 and not t=0. Or put differently, I want to 'move' my graph a little to the left relative to the x axis. How do I go about this?
Thank you in advance!

Antworten (1)

J. Webster
J. Webster am 15 Apr. 2016
might depend on what and how you're plotting. For the simplest case you can just do this...
t = 0:100;
data = somefunction(t);
plot(t-4, data);
  1 Kommentar
NS
NS am 18 Apr. 2016
Thank you! I've attached my .m file for reference, without the additional time commands yet. I'm trying to plot the pi function.
When I use your suggested code, I get an error for the 'plot(t-4, data)' command, saying vectors must be the same length. What would be causing the issue?
Thank you in advance!

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by