Brian Warehouse

Some birds aren`t meant to be caged, their feathers are just too bright... ...
posts - 40, comments - 16, trackbacks - 0, articles - 1

POJ 1045 Bode Plot

Posted on 2010-08-17 14:49 Brian 阅读(926) 评论(0)  编辑 收藏 引用 所属分类: POJ

我觉得有必要把它翻译一下,然后就会发现考得其实是数学,你在google 翻译上是得不到如下翻译的:
Description
考虑下面的交流电路。我们将假定电路在稳态。因此,节点1的电压和节点2的电压分别是v1 = VS coswt 和 v2 = VRcos (wt + q),其中Vs是电源电压,w是频率(弧度每秒),t是时间。VR是电阻R两端电压下降的幅度,q是它的相位。
POJ 1045 Bode Plot - Icho - Brian Warehouse
你需要写一个程序,以确定不同的w对应的VR值。您将需要两个电学定律来解决这个问题。第一
个是是欧姆定律,表述为V2 = iR,其中i是在电路顺时针流向的电流大小。
第二个是i = C d/dt (v1-v2),i与电容器两板上的电压有关。"d/dt" 意为求关于t的求导。
Input
输入包括一行或多行。第一行包括三个实数和一个非负整数。实数按顺序是VS,R,C。
整数n是测试用例的个数。接下来的n行就是输入,要求一行一个实数,代表w的值。

Output
输出n行的VR值,注意,结果精确到小数点后三位。
下面需要推导一下求VR的公式:
V2=iR=CR d/dt (VS*cos(wt)-VR*cos(wt+q))=VRcos(wt+q)
         = CR w (sin(wt+q)-sin(wt))=VRcos(wt+q)
下面用到高中数学当中的计算方法,分别令 t=0 和 wt+q=0 ,得到 CRw  tan b = 1 和 VR=CRw VS sin b ,
然后利用三角函数中的万能公式,求得 :VR = CRw VS / sqrt (1+ (CRw) ^ 2 ))

POJ 1045 Bode Plot - Icho - Brian Warehouse// C 编译器:
POJ 1045 Bode Plot - Icho - Brian Warehouse
#include <stdio.h>
POJ 1045 Bode Plot - Icho - Brian Warehouse#include 
<math.h>
POJ 1045 Bode Plot - Icho - Brian Warehouse
int main()
POJ 1045 Bode Plot - Icho - Brian WarehousePOJ 1045 Bode Plot - Icho - Brian Warehouse
POJ 1045 Bode Plot - Icho - Brian Warehouse{
POJ 1045 Bode Plot - Icho - Brian Warehouse    
int i=0,n;
POJ 1045 Bode Plot - Icho - Brian Warehouse    
double VR,VS,R,C,w;
POJ 1045 Bode Plot - Icho - Brian Warehouse    scanf(
"%lf%lf%lf%d",&VS,&R,&C,&n);    
POJ 1045 Bode Plot - Icho - Brian Warehouse    
POJ 1045 Bode Plot - Icho - Brian Warehouse    
for (; i<n; i++)
POJ 1045 Bode Plot - Icho - Brian WarehousePOJ 1045 Bode Plot - Icho - Brian Warehouse    
POJ 1045 Bode Plot - Icho - Brian Warehouse{
POJ 1045 Bode Plot - Icho - Brian Warehouse        scanf(
"%lf",&w);
POJ 1045 Bode Plot - Icho - Brian Warehouse        VR
=C*R*w*VS / sqrt(1+C*C*R*R*w*w);
POJ 1045 Bode Plot - Icho - Brian Warehouse        printf(
"%.3lf\n",VR);
POJ 1045 Bode Plot - Icho - Brian Warehouse    }

POJ 1045 Bode Plot - Icho - Brian Warehouse    
return 0;
POJ 1045 Bode Plot - Icho - Brian Warehouse}

注意 , 用 double 

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理