Thread Subject: plot question

Subject: plot question

From: nordmoon

Date: 18 Oct, 2009 16:45:05

Message: 1 of 6

Hi,

I have a question about plotting. Can you somehow set the x-axis to the interval that you want it to show?

Like its calculating from x = 1e11 x = 1e28, but you want it to only show result (when plotting) with x = 1e14 x 1e15.

When I plot my result I have zero in y for above x = 1e15
but something happens in x = 1e15 range when zooming in that I want to display.

I tried to only calculate between this range but I got the same figure with almost zero and at the beginning something happens when zoming in. What is this so?

My x matrix (I have commented out some parts):

n = [%1e+008;2e+008;3e+008;4e+008;8e+008;6e+008;7e+008;8e+008;9e+008;
% 1e+009;2e+009;3e+009;4e+009;5e+009;6e+009;7e+009;8e+009;9e+009;
% 1e+010;2e+010;3e+010;4e+010;5e+010;6e+010;7e+010;8e+010;9e+010
% 1e+011;2e+011;3e+011;4e+011;5e+011;6e+011;7e+011;8e+011;9e+011;
% 1e+012;2e+012;3e+012;4e+012;5e+012;6e+012;7e+012;8e+012;9e+012;
      1e+013;2e+013;3e+013;4e+013;5e+013;6e+013;7e+013;8e+013;9e+013;
      1e+014;2e+014;3e+014;4e+014;5e+014;6e+014;7e+014;8e+014;9e+014;
     1e+015;2e+015;3e+015;4e+015;5e+015;6e+015;7e+015;8e+015;9e+015;
     1e+016;2e+016;3e+016;4e+016;5e+016;6e+016;7e+016;8e+016;9e+016;
     1e+017;2e+017;3e+017;4e+017;5e+017;6e+017;7e+017;8e+017;9e+017 ];
% 1e+018;2e+018;3e+018;4e+018;5e+018;6e+018;7e+018;8e+018;9e+018;
% 1e+019;2e+019;3e+019;4e+019;5e+019;6e+019;7e+019;8e+019;9e+019;
% 1e+020;2e+021;3e+021;4e+021;5e+021;6e+021;7e+021;8e+021;9e+021;
% 1e+022;2e+022;3e+022;4e+022;5e+022;6e+022;7e+022;8e+022;9e+022;
% 1e+023;2e+023;3e+023;4e+023;5e+023;6e+023;7e+023;8e+023;9e+023;
% 1e+024;2e+024;3e+024;4e+024;5e+024;6e+024;7e+024;8e+024;9e+024;
% 1e+025;2e+025;3e+025;4e+025;5e+025;6e+025;7e+025;8e+025;9e+025;
% 1e+026;2e+026;3e+026;4e+026;5e+026;6e+026;7e+026;8e+026;9e+026;
% 1e+027;2e+027;3e+027;4e+027;5e+027;6e+027;7e+027;8e+027;9e+027;
% 1e+028;2e+028;3e+028;4e+028;5e+028;6e+028;7e+028;8e+028;9e+028];

Subject: plot question

From: ImageAnalyst

Date: 18 Oct, 2009 17:45:41

Message: 2 of 6

On Oct 18, 12:45 pm, nordmoon <ariana...@gmail.com> wrote:
> Hi,
>
> I have a question about plotting. Can you somehow set the x-axis to the interval that you want it to show?
>
> Like its calculating from x = 1e11 x = 1e28, but you want it to only show result (when plotting) with x = 1e14 x 1e15.
>
> When I plot my result I have zero in y for above x = 1e15
> but something happens in x = 1e15 range when zooming in that I want to display.
>
> I tried to only calculate between this range but I got the same figure with almost zero and at the beginning something happens when zoming in. What is this so?
>
> My x matrix (I have commented out some parts):
>
> n = [%1e+008;2e+008;3e+008;4e+008;8e+008;6e+008;7e+008;8e+008;9e+008;
> %      1e+009;2e+009;3e+009;4e+009;5e+009;6e+009;7e+009;8e+009;9e+009;
> %      1e+010;2e+010;3e+010;4e+010;5e+010;6e+010;7e+010;8e+010;9e+010
> %      1e+011;2e+011;3e+011;4e+011;5e+011;6e+011;7e+011;8e+011;9e+011;
> %      1e+012;2e+012;3e+012;4e+012;5e+012;6e+012;7e+012;8e+012;9e+012;
>       1e+013;2e+013;3e+013;4e+013;5e+013;6e+013;7e+013;8e+013;9e+013;
>       1e+014;2e+014;3e+014;4e+014;5e+014;6e+014;7e+014;8e+014;9e+014;
>      1e+015;2e+015;3e+015;4e+015;5e+015;6e+015;7e+015;8e+015;9e+015;
>      1e+016;2e+016;3e+016;4e+016;5e+016;6e+016;7e+016;8e+016;9e+016;
>      1e+017;2e+017;3e+017;4e+017;5e+017;6e+017;7e+017;8e+017;9e+017 ];
> %      1e+018;2e+018;3e+018;4e+018;5e+018;6e+018;7e+018;8e+018;9e+018;
> %      1e+019;2e+019;3e+019;4e+019;5e+019;6e+019;7e+019;8e+019;9e+019;
> %      1e+020;2e+021;3e+021;4e+021;5e+021;6e+021;7e+021;8e+021;9e+021;
> %      1e+022;2e+022;3e+022;4e+022;5e+022;6e+022;7e+022;8e+022;9e+022;
> %       1e+023;2e+023;3e+023;4e+023;5e+023;6e+023;7e+023;8e+023;9e+023;
> %      1e+024;2e+024;3e+024;4e+024;5e+024;6e+024;7e+024;8e+024;9e+024;
> %      1e+025;2e+025;3e+025;4e+025;5e+025;6e+025;7e+025;8e+025;9e+025;
> %      1e+026;2e+026;3e+026;4e+026;5e+026;6e+026;7e+026;8e+026;9e+026;
> %      1e+027;2e+027;3e+027;4e+027;5e+027;6e+027;7e+027;8e+027;9e+027;
> %      1e+028;2e+028;3e+028;4e+028;5e+028;6e+028;7e+028;8e+028;9e+028];

------------------------------------------------------
Where's your "y" array? Where's your zooming code?
Can't you just plot the part of the array where x>=1e15?

x = [
      1e+013;2e+013;3e+013;4e+013;5e+013;6e+013;7e+013;8e+013;9e+013;
      1e+014;2e+014;3e+014;4e+014;5e+014;6e+014;7e+014;8e+014;9e+014;
     1e+015;2e+015;3e+015;4e+015;5e+015;6e+015;7e+015;8e+015;9e+015;
     1e+016;2e+016;3e+016;4e+016;5e+016;6e+016;7e+016;8e+016;9e+016;
     1e+017;2e+017;3e+017;4e+017;5e+017;6e+017;7e+017;8e+017;9e
+017 ];
y = rand(size(x, 1), 1);
subplot(2,1,1);
loglog(x(1:end), y(1:end))
title('All x');
subplot(2,1,2);
firstX = find(x>=1e15, 1, 'first')
loglog(x(firstX:end), y(firstX:end))
title('Only x >= 1e15');

Subject: plot question

From: nordmoon

Date: 18 Oct, 2009 19:32:27

Message: 3 of 6

The problem was solved. I found out that I just needed to inverse the ratio. I got zero y-value results because in my equation it was divided by something big.

I have another plot question. If you set the y-value in plot to be a matrix, which color order does the program set the vectors different result/lines?

y = [ v1 v2 v3 v4 ]

v1 - vector 1
v2 - vector 2
etc.

Then what color will be assigned to v1, v2, v3.. etc when you use plot(x,y)?

Subject: plot question

From: ImageAnalyst

Date: 19 Oct, 2009 00:06:13

Message: 4 of 6

I don't know. If it matters to you, just set the colors individually
to whatever you want, and plot individually with the plot command
(with "hold on" set after calling the first one.)

Subject: plot question

From: nordmoon

Date: 23 Nov, 2009 15:06:05

Message: 5 of 6

I noted when I plot result with x >= 10^something, only the biggest 10^something number range is displayed in the plot and all under (10^somthing-1) are not displayed in the graph. Is there a way to get the whole region of the x vector, maybe log plot will display everything or???

Anyone know?

Subject: plot question

From: dpb

Date: 23 Nov, 2009 15:24:37

Message: 6 of 6

nordmoon wrote:
> I noted when I plot result with x >= 10^something, only the biggest
> 10^something number range is displayed in the plot and all under
> (10^somthing-1) are not displayed in the graph. Is there a way to get
> the whole region of the x vector, maybe log plot will display
> everything or???
>
> Anyone know?

Pretty hard to "know" w/ no more specific description, but one would
presume that indeed there might be a scaling problem in trying to plot
wide ranges of a variable on a linear axis.

Maybe try semilogx|y and see???

--

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com