Now that you've solved your problem, will you please mark this thread as solved? If you don't know how, here's how to do it?
However, please note that if this is your actual code, you once again omitted the *
in these two lines:
and
Also, let me give you a better way for this problem. You actually don't need the for
loop here:
# Funzione di amplificazione A2
H <- 10 # [m] Spessore strato
Vs <- 200 # [m/s] Velocità onde S
D <- 0.05 # [%] Smorzamento
# Funzione di amplificazione A2
A2 <- function(f) abs(x = (1/(cos(2 * pi *f * H * (1 - 1i * D) / Vs))))
# Calcolo massimo
N <- seq(from = 0, to = 100, by = 0.001)
VettoreMassimo <- A2(f = N)
m <- max(VettoreMassimo)
f0 <- N[which.max(x = VettoreMassimo)]
# Stampa risultati
cat("Valore massimo di A2:", m)
#> Valore massimo di A2: 12.73528
cat("Frequenza fondamentale f0:", f0)
#> Frequenza fondamentale f0: 4.987
Created on 2019-02-23 by the reprex package (v0.2.1)