cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

Loop to plot

JB_10220769
7-Bedrock

Loop to plot

Can I loop the function to solve and plot the equation in prime? 

ACCEPTED SOLUTION

Accepted Solutions
Werner_E
25-Diamond I
(To:JB_10220769)

Something like this?

Werner_E_2-1655479600043.png

You have to use matrix indices when defining sigma.0 and sigma.1 and add the unit,  even if the value is zero.

(vectorization isn't necessary here as but a good habit to explicitly apply)

 

Of course the same effect could be achieved easier

Werner_E_1-1655479564611.png

 

 

View solution in original post

3 REPLIES 3
Werner_E
25-Diamond I
(To:JB_10220769)

Something like this?

Werner_E_2-1655479600043.png

You have to use matrix indices when defining sigma.0 and sigma.1 and add the unit,  even if the value is zero.

(vectorization isn't necessary here as but a good habit to explicitly apply)

 

Of course the same effect could be achieved easier

Werner_E_1-1655479564611.png

 

 

Is there any specific reason why I am only getting two values for returning sigma

JB_10220769_0-1655482210353.png

 

Werner_E
25-Diamond I
(To:JB_10220769)

As an afterthought I overlooked that you can/should delete the last single sigma_i in the for loop as it has no effect. There is also no need for "j" which is never used.

 


@JB_10220769 wrote:

Is there any specific reason why I am only getting two values for returning sigma

 


Yes, its because you defined a FUNCTION epsilon(..), not a simple variable epsilon as i did. This function is never called and so sigma consists of the two values you manually assigned.

Note that nothing you change inside a program can change anything on worksheet level, even if the variable has the very same name (like sigma in your case). Only way to change a worksheet variable with a program is via the return value and the names of the (local) variables in the program dos not matter. They must not be the same as the variables in the worksheet.

If you really need a function because you intend to call it with different initial values sigma[1, you should define it as epsilon(delta) and not of delta[i.  But I guess you just want the variable epsilon as a vector.

 

I see that you obviously do not just want a vector epsilon but also the corresponding vector delta, right?

You can do it that way

Werner_E_6-1655485573521.png

 

or I would prefer this

Werner_E_3-1655485295405.png

 

And of course you may plot epsilon over sigma if you like

Werner_E_4-1655485351616.png

 

P6 worksheet attached

 

 

Announcements

Top Tags