For Loop - first iteration(s) not correct?

For Loop - first iteration(s) not correct? - value in first iteration(s) is not being calculated correctly, later iterations are correct...? - Сообщения

#1 Опубликовано: 26.01.2019 16:37:00
justhumm

justhumm

0 сообщений из 18 понравились пользователям.

Группа: User

I'm putting together a worksheet that assembles and manipulates a piecewise function.

The user enters X and Y coordinates in one matrix. And then uses a second matrix to describe how those points are connected.

I am getting incorrect values from a For Loop that calculates geometric properties for each line (or curve) segment (length, slope, y-intercept, etc.).

The slope (m = dy / dx) of the first two segments are being output as Zero, but the values (based on the input coordinates) should both be c. 3.7.

The third segment is a curve and those values (radius, chord length, etc.) are being calculated correctly.

The fourth segment is another line and the slope (c. 2.9) is being calculated correctly, this time.

I'm assuming that there is something wrong with my loop, but I am having trouble figuring it out. Any suggestions?

Thanks!

[albumimg]1583[/albumimg]

[albumimg]1582[/albumimg]

piecewise-forum.sm (59 КиБ) скачан 42 раз(а).
#2 Опубликовано: 26.01.2019 23:03:52
Alvaro Diaz Falconi

Alvaro Diaz Falconi

992 сообщений из 1674 понравились пользователям.

Группа: User

Hi. Near the end, in the loop, you use "slope:=0" for the case circle. Change it by "slope[i:=0".

Best regards.

Alvaro.
1 пользователям понравился этот пост
justhumm 27.01.2019 02:09:00
#3 Опубликовано: 27.01.2019 02:12:53
justhumm

justhumm

0 сообщений из 18 понравились пользователям.

Группа: User

Wow. I completely missed that. Thanks for the reply!

[albumimg]1584[/albumimg]
  • Новые сообщения Новые сообщения
  • Нет новых сообщений Нет новых сообщений