Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

R using curve function

I have my funcion :

fun1 <- function( x, y, z ){
  1 / (1 + (x / y)^z) 
}

I want to crate curve for my function

On X axxis I want values I will give for x, e.g. 10 50, 1000 in my function for Y axis I want fun1 results given different x. For y in function I wants the value 1 and for z I want 0.5 always regardless of the given x.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

I try to emulate this code from the site https://r-charts.com/evolution/curve/

# Function
fun <- function(x) {
  sin(sqrt(x ^ 2))
}

# Plot
curve(fun, from = -7, to = 7)

>Solution :

You must define your function with a single argument, x:

fun1 <- function( x){
   1 / (1 + (x / 1)^.5) 
}
curve(fun1, from=10, to=1000, n=101)

Plot

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading