Help, I have this code, where I wanted to use 'dsolve to get the answer, but it shows me an 'empty sym' like answer:
clear all
clc
disp('Se resolverá una ecuación integro - diferencial')
syms vel(t) t desp(t)
V = input('Ingrese el voltaje: ' );
l = input('Ingrese la longitud: ');
M = input('Ingrese la masa: ');
B = input('Ingrese la inducción magnética: ');
froz = input('Ingrese la fuerza de rozamiento: ');
eqn = diff(vel,t) == (1/M)*(((V*l*B)-(vel(t)*(l^2)*(B^2)))/(1+(2*int(vel, [0 t])))-froz);
%eqn = diff(vel,t) == 2*int(vel, [0 t])
vel(t) = dsolve(eqn, 'vel(0) = 0')
pretty(vel(t))
What can I do?

댓글 수: 2

Walter Roberson
Walter Roberson 2018년 11월 27일
Can you give us some sample inputs for V l M B froz ?
The int() in the equation is going to make it difficult to solve symbolically.
Alberto Cadena Vaca
Alberto Cadena Vaca 2018년 11월 27일
V, l M B and froz are just numbers.

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

 채택된 답변

madhan ravi
madhan ravi 2018년 11월 27일
편집: madhan ravi 2018년 11월 27일

0 개 추천

Matlab is having trouble to solve the equation like sir Walter suggests so i converted it into numerical solution:
%SYMBOLIC TO NUMERICAL METHOD
clear all
clc
disp('Se resolverá una ecuación integro - diferencial')
syms vel(t)
V = input('Ingrese el voltaje: ' );
l = input('Ingrese la longitud: ');
M = input('Ingrese la masa: ');
B = input('Ingrese la inducción magnética: ');
froz = input('Ingrese la fuerza de rozamiento: ');
vars=vel(t)
eqn = diff(vel,t) == (1/M)*(((V*l*B)-(vel(t)*(l^2)*(B^2)))/(1+(2*int(vel, [0 t])))-froz);
%eqn = diff(vel,t) == 2*int(vel, [0 t])
% vel(t) = dsolve(eqn, 'vel(0) = 0')
% pretty(vel(t))
V = odeToVectorField(eqn)
M = matlabFunction(V,'vars', {'t','Y'})
interval = [0 10]; %time interval
y0 = 0; %initial conditions
ySol = ode45(M,interval,y0);
tValues = linspace(interval(1),interval(2),1000);
yValues = deval(ySol,tValues,1); %number 1 denotes first solution likewise you can mention 2 & 3 for the next two solutions
plot(tValues,yValues)
%DIRECT NUMERICAL METHOD
V = input('Ingrese el voltaje: ' );
l = input('Ingrese la longitud: ');
M = input('Ingrese la masa: ');
B = input('Ingrese la inducción magnética: ');
froz = input('Ingrese la fuerza de rozamiento: ');
[t,x] = ode45(@(t,x)myod(t,x,V,l,M,B,froz),[0 10],0);
plot(t,x,'-om')
function dxdt = myod(t,x,V,l,M,B,froz)
dxdt =(1/M)*(((V*l*B)-(x(1)*(l^2)*(B^2)))/(1+(2*cumtrapz(x(1))))-froz);
end
An example of the solution graph produced:

댓글 수: 3

Walter Roberson
Walter Roberson 2018년 11월 27일
I agree that it is likely that you will need to use numeric methods.
madhan ravi
madhan ravi 2018년 11월 27일
Thank you sir Walter ?
Hewa selman
Hewa selman 2021년 12월 25일
hello sir.
Is this code is suitable for system of integro differential equations?

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

추가 답변 (1개)

Alberto Cadena Vaca
Alberto Cadena Vaca 2018년 11월 27일

0 개 추천

Help:(
I tried the code but, when I plot the graph, there is just the function x = 0 and don't know why...

댓글 수: 3

Walter Roberson
Walter Roberson 2018년 11월 27일
we do not know your inputs
Alberto Cadena Vaca
Alberto Cadena Vaca 2018년 11월 27일
V = 1
B = 1
M = 0.1
l = 0.1
froz = 1
madhan ravi
madhan ravi 2018년 11월 27일
The below is the graph I got with the datas you gave:
Screen Shot 2018-11-27 at 11.01.22 PM.png

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

카테고리

도움말 센터File Exchange에서 Programming에 대해 자세히 알아보기

제품

릴리스

R2014a

질문:

2018년 11월 27일

댓글:

2021년 12월 25일

Community Treasure Hunt

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

Start Hunting!

Translated by