Message Boards Message Boards

0
|
6314 Views
|
10 Replies
|
1 Total Likes
View groups...
Share
Share this post:

How to plot graphics from a series

Dear friends,
I´m in trouble with a problem that seems to be simple to solve. But I have wasted too much time, without success. I evaluate two series with 1000 terms, for the sinus and cossinus components of the modulus as function of y that varies from 0 to 0.25. No problem in doing this, but in plotting... I could not have a graphic with modulus as function of y. One of the best I could have is show in the attached .nb file. Would you help me, please ?
Scabral

Attachments:
POSTED BY: Sergio Cabral
10 Replies

Hi,

I am not quite sure what you want to achieve, but the thing is that your "function" Modulus does not seem to be a function on y anymore. That is because you have the line:

y = Range[0, 0.25, 0.01] 

Without it, you get a plot:

enter image description here

The notebook is attached.

Cheers,

Marco

Attachments:
POSTED BY: Marco Thiel

Hmmmm...What a nice help, Marco. The function is defined with basis on y and limits for y is defined only when plotting ! Thank you so much ! It does work. A suppose the command ClearAll["Global`*"] is a kind of refresh for all the undefined parameters (?). All the best !

POSTED BY: Sergio Cabral

No problem. ClearAll clears all symbols in a given context; see here under Generalisations and Extensions. It's quite a useful command.

With the Range command you defined y to be a list of numbers. When you then used y in the function it did not use that as an independent variable anymore.

Cheers,

Marco

POSTED BY: Marco Thiel

Perfect. Great ! Every day I get more and more inspired with Wolfram. All the best !

POSTED BY: Sergio Cabral

Marco ! Please, how do I export data of this graphic to a .txt or .xls file ? I want to compare results from Wolfram and excel. The nb. file is attached and the command export does notwork. Would you, please? Thank you ?

Attachments:
POSTED BY: Sergio Cabral
Posted 9 years ago

This y=Range[...] things looks like you have worked with Matlab before (where it is usual to handle such situations like this) am I right?

POSTED BY: Simon Tyran

Yes! Exactly this! I could recognize this command in the Help and then I took it. Matlab I left behind because it could not solve some tricking Laplace transforms that Wolfram did at once. In fact, I started with Fortran in the late of the 80´s...Pascal, Basic, C and then I moved to Excel for a long time. But it became unsatisfactory for deeper investigations and then here I am...

POSTED BY: Sergio Cabral

No, i haven't.

POSTED BY: Marco Thiel

Sure. The problem seems to be that instead of exporting values to the file you actually try to export the function.

In order to create a list (a table) of values you could use this export command:

Export["~/Desktop/teste.txt", Table[Modulo /. y -> i // N, {i, 0, 0.25, 0.025}]]

The idea is that it takes the Modulo expression and substitutes the y by values in the range from 0 to 0.25 in steps of 0.025. The N helps to obtain numerical values.

I hope that this helps. If you want also the "x-coordinate" you can use:

Export["~/Desktop/teste.txt", Table[{i,Modulo /. y -> i // N}, {i, 0, 0.25, 0.025}]]

Cheers,

M.

POSTED BY: Marco Thiel

Wooow ! Perfect, Marco ! Thank you immensely ! It got perfect ! Scabral

POSTED BY: Sergio Cabral
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract