필터 지우기
필터 지우기

Differential equation not working

조회 수: 2 (최근 30일)
Reji G
Reji G 2022년 10월 17일
댓글: Walter Roberson 2022년 10월 21일
I wanted to implement the equation below:
I wrote the program as follows. But nothing showing up in the plot.
clc; close all; clear all;
t=0.01:0.001:10;
V=575*sin(2*pi*t);
I=100*sin(2*pi*t);
P0=250;
syms V(t)
syms I(t)
ode = diff(V) == (V*I)*diff(I)-((V/0.01)*(((V*I)/P0)-1));
VSol(t) = dsolve(ode);
fplot(VSol(t),[0 10]);
  댓글 수: 2
Torsten
Torsten 2022년 10월 17일
편집: Torsten 2022년 10월 17일
Why do you specify I and V and then try to solve a differential equation for V ? If you know that V =575*sin(2*pi*t), you don't need to solve a differential equation.
Further, in order to plot a possible solution for V, you will have to specify an initial condition, e.g. V at t=0.
Reji G
Reji G 2022년 10월 18일
What should I modify in the code ?
If V(0)=0.1, then ?
I'm not knowing much of these. That's why came to help center

댓글을 달려면 로그인하십시오.

답변 (1개)

Torsten
Torsten 2022년 10월 18일
I = @(t)100*sin(2*pi*t);;
dIdt = @(t) 2*pi*100*cos(2*pi*t);
V0 = 0.1;
fun = @(t,V,I,dIdt) V/I(t)*dIdt(t)-V/0.01*(V*I(t)/250-1.0);
[T,V] = ode45(@(t,V) fun(t,V,I,dIdt),0.01:0.001:10,V0);
plot(T,V)
  댓글 수: 19
Reji G
Reji G 2022년 10월 21일
Thank you Torsten.
For I = @(t)100*sin(2*pi*t); your first code itself is working fine.
My concern is I = @(t)100*sin(100*pi*t); (in place of 1Hz if I give 50 HZ(2->100)), the program is showing 5 errors. I want a plot for I = @(t)100*sin(100*pi*t).
Walter Roberson
Walter Roberson 2022년 10월 21일
f = 50; %Hz
I = @(t)100*sin(2*pi*f*t);
dIdt = @(t) 2*pi*f*cos(2*pi*t); %guessing here
V0 = 0.1;
fun = @(t,V,I,dIdt) V/I(t)*dIdt(t)-V/0.01*(V*I(t)/250-1.0);
delta = 1/(10*f);
tspan = delta:delta:1/(2*f)-delta;
[T,V] = ode45(@(t,V) fun(t,V,I,dIdt), tspan, V0);
fun_inter = @(t)interp1(T,V,delta+mod(t-delta, 1/f-delta));
x = 0:delta:10;
plot(x,fun_inter(x))
Heavy aliasing on the drawing.
x = 0:delta:1;
plot(x,fun_inter(x))

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by