zoukankan      html  css  js  c++  java
  • proj1045

    Language:
    Bode Plot
    Time Limit: 1000MS   Memory Limit: 10000K
    Total Submissions: 12040   Accepted: 7721

    Description

    Consider the AC circuit below. We will assume that the circuit is in steady-state. Thus, the voltage at nodes 1 and 2 are given by v1 = VS coswt and v2 = VRcos (wt + q ) where VS is the voltage of the source, w is the frequency (in radians per second), and t is time. VR is the magnitude of the voltage drop across the resistor, and q is its phase.

    You are to write a program to determine VR for different values of w. You will need two laws of electricity to solve this problem. The first is Ohm's Law, which states v2 = iR where i is the current in the circuit, oriented clockwise. The second is i = C d/dt (v1-v2) which relates the current to the voltage on either side of the capacitor. "d/dt"indicates the derivative with respect to t. 

    Input

    The input will consist of one or more lines. The first line contains three real numbers and a non-negative integer. The real numbers are VS, R, and C, in that order. The integer, n, is the number of test cases. The following n lines of the input will have one real number per line. Each of these numbers is the angular frequency, w. 

    Output

    For each angular frequency in the input you are to output its corresponding VR on a single line. Each VR value output should be rounded to three digits after the decimal point.

    Sample Input

    1.0 1.0 1.0 9
    0.01
    0.031623
    0.1
    0.31623
    1.0
    3.1623
    10.0
    31.623
    100.0

    Sample Output

    0.010
    0.032
    0.100
    0.302
    0.707
    0.953
    0.995
    1.000
    1.000

    Source

     
     
    公式推导:
    V2=I.R=C.R.d/dt(Vs*cos(Wt)-Vr*cos(Wt+B))=Vrcos(wt+B)
    
    C.R.W.(Vr.sin(wt+b)-Vs.sin(wt))=Vr*cos(wt+b)
    
    令t=0化简得:   tan(b)=1/(C.R.W)-------------(1)
    令wt+b=0化简得:Vr=C.R.W.Vs*sin(b)------------(2)
                    sinb=sqrt(tanb^2/(1+tanb^2))---(3)
    
                  设a=C.R.W
    由(1),(2),(3)得:   Vr=a.Vs/sqrt(1+a^2)).
    
    //公式推导:V2=iR=CR d/dt(Vs*cos(wt)-Vr*cos(wt+b))=Vrcos(wt+b)
    //          CRw(sin(wt+b)-sin(wt))=Vr*cos(wt+b)
    //          令t=0化简得:   tan(b)=1/(CRw)-------------(1)
    //          令wt+b=0化简得:Vr=CRwVs*sin(b)------------(2)
    //          由(1),(2)得:   Vr=CRwVs/sqrt(1+(CRw)^2))
    
    #include <stdio.h>
    #include <math.h>
    int main()
    {
    	double vs,r,c,w,vr;
    	int i,t;
    	scanf("%lf %lf %lf %d",&vs,&r,&c,&t);
    	for(i=1;i<=t;i++)
    	{
    		scanf("%lf",&w);
    		vr=c*r*w*vs/sqrt(1+c*r*w*c*r*w);
    		printf("%.3lf
    ",vr);
    	}
    	return 0;
    }
  • 相关阅读:
    javascript设计思维
    asp.net时间类-格式-方法应用
    javascript简写精练
    保存html代码
    jQuery.cookie应用操作
    ASP.NET 打包多CSS或JS文件以加快页面加载速度的Handler
    Asp.Net下通过切换CSS换皮肤
    让你的ASP.NET虚拟主机也支持子网站
    javascript获取和设置URL中的参数
    获取和设置URL里星号(#)的参数
  • 原文地址:https://www.cnblogs.com/candycloud/p/3399982.html
Copyright © 2011-2022 走看看