Closed swopnil123 closed 2 months ago
When writing row vectors, type a space after each comma. Write [0, 0]
, not [0,0]
. I know that is subtle but I wanted students taking notes in math class to have the ability to write an interval. So intervals can be written without a space, like [0,1]
. I still need to figure out some way to enable an open interval like [0,1[
.
I'm going to revise the path
statement today (for reasons unrelated to your question). It will be ready tomorrow (possibly later today) and I'll be sure to use your example as a test case.
Can we use variables/vectors matrices that are defined outside the draw environment but inside the same hurmet document?
Yes. Write the variable name(s) as an argument to the draw()
function, as in draw(x, y)
Thanks. Is there a way we can label axes? Can we include legends if we plot multiple traces in the same figure?
I've revised the path
statement to a syntax that is lees weird. You can now get your response spectrum plot. Copy the following text and invoke the command 𝐌▾| Paste from Markdown.
¢` format = "h4" `
¢` T = [0:0.1:6] = ! `
¢` function Ch(T, T_a, T_c, T_d, α)
C = []
for el in T
if el ≤ T_a
C = C & (1 + (α - 1) × el / T_a)
elseif T_a ≤ el and el ≤ T_c
C = C & α
elseif T_c ≤ el and el ≤ T_d
C = C & α × T_c/el
elseif el ≥ T_d
C = C & (α × T_c × T_d) / el²
end
end
return C
end `
¢` S_a = Ch(T, 0.3, 0.9, 5, 2.25) = ! `
Response Spectrum
¢` draw(T, S_a)
title "Response Spectrum"
frame 250, 150
view -0.9, 6.5, -0.9, 3.2
axes 1, 1, "labels"
strokewidth 2
path T & S_a
text [-0.7, 2.75], "S~a~"
text [5.5, -0.7], "T"
end `
Is there a way we can label axes? ... legends?
The draw
environment is pretty low level. There are no current provisions for automatic labels or legends. There may be such things in the future. I'm still working out the details for draw
.
Thanks. But it appears that trace is missing
This is the code inside draw
Should I wait for a couple of hours for this to work?
Thank you very much Ron! It works now. I'm closing this.
There seems to be an issue with the path command inside the draw environment
draw() title "sin x" frame 250, 150 view -5, 5, -3 axes 2, 1, "labels" strokewidth 2 plot sin(x), 51 line [0,0;3,1] text [1.6, 1.35], "sin x" end
line seems to work here
draw() title "sin x" frame 250, 150 view -5, 5, -3 axes 2, 1, "labels" strokewidth 2 plot sin(x), 51 path [0,0], [1,4;3,3] text [1.6, 1.35], "sin x" end
however, path doesn't work.
Also, one question. Can we use variables/vectors matrices that are defined outside the draw environment but inside the same hurmet document?