如何在R中使用复数绘制函数? [英] How can I plot a function in R with complex numbers?

查看:98
本文介绍了如何在R中使用复数绘制函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在R中绘制以下函数

I want to plot the following function in R

f(w) = 1/(1-5*e^(-iw))

其中i是-1的平方根。 R可以在绘图中处理复数吗?

where i is the square root of -1. Can R handle complex numbers in plotting?

推荐答案

这应该可以帮助您入门(主要是通过演示R用来表示复数的符号)和指数函数)。

This should get you started (mostly by demonstrating the notation R uses for representing complex numbers and the exponential function).

f <- function(x) 1/(1-5*exp(-(0+1i)*x))
x <- seq(0, 2*pi, by=0.1)
plot(f(x))

这篇关于如何在R中使用复数绘制函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆