getting output in the form of 'vpaintegral' when applying dsolve command

Hello All,
I have written a code to solve a problem. In my code, in the last section, when I am applying "dsolve" command, code gives me an error. Could anybody please help me to solve this error.
Waiting for responses.
Thank you
%% AAKASH DEWANGAN 9/12/2021
clc; clear all; close all
syms p1(t) p2(t) p3(t) p4(t) p5(t) p6(t) rho L m v T k G y_mass(t)
%% parameters
rho = 1.3; T = 45000; L = 60; k = 15000; m = 7; v = 350*1000/3600; G = 0.1 % HIGH speed parameters
Dp1 = diff(p1); D2p1 = diff(p1,2); Dp2 = diff(p2); D2p2 = diff(p2,2); Dp3 = diff(p3); D2p3 = diff(p3,2);
%%
% first matrix terms
AA = rho*L/2 + m*(sin(pi*v*t/L))^2;
BB = m*sin(2*pi*v*t/L)*sin(pi*v*t/L);
CC = m*sin(3*pi*v*t/L)*sin(pi*v*t/L);
DD = rho*L/2 + m*(sin(2*pi*v*t/L))^2;
EE = m*sin(2*pi*v*t/L)*sin(3*pi*v*t/L);
FF = rho*L/2 + m*(sin(3*pi*v*t/L))^2;
% second matrix terms
GG = T*(pi/L)^2*(L/2) + k*(sin(pi*v*t/L))^2;
HH = k*sin(2*pi*v*t/L)*sin(pi*v*t/L);
II = k*sin(pi*v*t/L)*sin(3*pi*v*t/L);
JJ = T*(2*pi/L)^2*(L/2) + k*(sin(2*pi*v*t/L))^2;
KK = k*sin(2*pi*v*t/L)*sin(3*pi*v*t/L);
LL = T*(3*pi/L)^2*(L/2) + k*(sin(3*pi*v*t/L))^2;
% RHS
MM = k*G*sin(pi*v*t/L);
NN = k*G*sin(2*pi*v*t/L);
OO = k*G*sin(3*pi*v*t/L);
%%
tim = zeros(1,2)
poly_order = 10;
F_val = k*G; jloss = 1;
y_massVal = G
p3_expression = 0; p1_expression = 0; p2_expression = 0; p3dot_expression = 0; p1dot_expression = 0; p2dot_expression = 0;
axis tight
vid = VideoWriter('ForMATLAB.avi');
open(vid);
path = pwd ;
%%
for contacts = 1:100
contacts
% Equation (coupled system of ODE to solve for p)
Eq1 = AA*diff(p1,t,2) + BB*diff(p2,t,2) + CC*diff(p3,t,2) + GG*p1 + HH*p2 + II*p3 == MM; % Equation 1
Eq2 = BB*diff(p1,t,2) + DD*diff(p2,t,2) + EE*diff(p3,t,2) + HH*p1 + JJ*p2 + KK*p3 == NN; % Equation 2
Eq3 = CC*diff(p1,t,2) + EE*diff(p2,t,2) + FF*diff(p3,t,2) + II*p1 + KK*p2 + LL*p3 == OO; % Equation 3
%%
[V,S] = odeToVectorField(Eq1, Eq2, Eq3); % converts ODE in state space form
ftotal = matlabFunction(V, 'Vars',{'t','Y'}); % Using readymade MATLAB function to solve using ODE 45
% ^-^ - single quotes1 + l*p2 + m*p3== p
tstart = tim(jloss)
interval = [tstart L/v]; % Time Interval to run the program
p3_IC = subs(p3_expression,t,tim(jloss))
p3dot_IC = subs(p3dot_expression,t,tim(jloss))
p2_IC = subs(p2_expression,t,tim(jloss))
p2dot_IC = subs(p2dot_expression,t,tim(jloss))
p1_IC = subs(p1_expression,t,tim(jloss))
p1dot_IC = subs(p1dot_expression,t,tim(jloss))
IC = double([p3_IC p3dot_IC p1_IC p1dot_IC p2_IC p2dot_IC ])
%% ==========================================================================
[tim pSol] = ode45(@(t,Y)ftotal(t,Y),interval,IC); % Using ODE 45 to solve stste space form of ODE
p3Values = (pSol(:,1)); % number 1 denotes first solution likewise you can mention 2 ,3 & 4 for the next three solutions
p3dotValues = (pSol(:,2));
p1Values = (pSol(:,3)); % number 1 denotes first solution likewise you can mention 2 ,3 & 4 for the next three solutions
p1dotValues = (pSol(:,4));
p2Values = (pSol(:,5)); % number 1 denotes first solution likewise you can mention 2 ,3 & 4 for the next three solutions
p2dotValues = (pSol(:,6));
%% Curve fitting
p_1 = polyfit(tim,p1Values,poly_order) % curve fitting of data points using polynomial (third argument shows degree of polynomial)
for i = 1:length(p_1)
ele_p_1(i) = p_1(i)*t^(length(p_1)-i);
end
p1_expression = vpa(sum(ele_p_1));
%%
p_1dot = polyfit(tim,p1dotValues,poly_order) % curve fitting of data points using polynomial (third argument shows degree of polynomial)
for idot = 1:length(p_1dot)
ele_p_1dot(idot) = p_1dot(idot)*t^(length(p_1dot)-idot);
end
p1dot_expression = vpa(sum(ele_p_1dot));
p_2 = polyfit(tim,p2Values,poly_order) % curve fitting of data points using polynomial (third argument shows degree of polynomial)
for j = 1:length(p_2)
ele_p_2(j) = p_2(j)*t^(length(p_2)-j);
end
p2_expression = vpa(sum(ele_p_2));
%%
p_2dot = polyfit(tim,p2dotValues,poly_order); % curve fitting of data points using polynomial (third argument shows degree of polynomial)
for jdot = 1:length(p_2dot)
ele_p_2dot(jdot) = p_2dot(jdot)*t^(length(p_2dot)-jdot);
end
p2dot_expression = vpa(sum(ele_p_2dot));
p_3 = polyfit(tim,p3Values,poly_order) % curve fitting of data points using polynomial (third argument shows degree of polynomial)
for ii = 1:length(p_3)
ele_p_3(ii) = p_3(ii)*t^(length(p_3)-ii);
end
p3_expression = vpa(sum(ele_p_3));
p_3dot = polyfit(tim,p3dotValues,poly_order) % curve fitting of data points using polynomial (third argument shows degree of polynomial)
for iidot = 1:length(p_3dot)
ele_p_3dot(iidot) = p_3dot(iidot)*t^(length(p_3dot)-iidot);
end
p3dot_expression = vpa(sum(ele_p_3dot));
%% Displacement u
syms x
ter1(t) = sin(pi*x/L)*p1_expression;
ter2(t) = sin(2*pi*x/L)*p2_expression;
ter3(t) = sin(3*pi*x/L)*p3_expression;
u = ter1 + ter2 + ter3
%% Force
u_vt = subs(u,x,v*t);
dd_u_vt = diff(u_vt,t,2);
F = k*G-k*u_vt-m*dd_u_vt
break
end
%% Error part (this part is giving me error)
syms y(t)
Dy = diff(y,t)
equation = m*diff(y,t,2) + k*y == F
condtn1 = y(tstart) == G; condtn2 = Dy(tstart) == 0;
condition = [condtn1; condtn2]
sol_y_mass = dsolve(equation,condition)
you = G - sol_y_mass
figure(101)
ezplot(you,[tstart L/v])
hold on
xlim([0,tim(L/v)])
beep

13 Comments

Does the form of "F" promise success for the integration ?
Could you show us "F" before the call to "dsolve" for "sol_y_mass" ?
Hi, Thanks for response.
When you run the code, you get expression of F as a polynomial (of order 10) expression. That same expression is being used in the last section of code.
F will be in the form of, F = a0 + a1*t + a2*t^2 + a3*t^3 + a4*t^4 + a5*t^5+...........10terms.
Thank you,
Can you simply integrate the non-homogenous ODE with a general 10-degree polynomial on the RHS and then identify and tranform/replace the polynomial coefficients to the ones you have at the end of the pre-dsolve step in the script. Since it is a linear ODE with a comparatively simple non-homogenous part this should be simple - on the other hand I think many things "should be simple" that aren't.
What error message do you get ? In principle, it should be no problem to integrate a 2nd order linear ODE with polynomial right-hand side:
syms m k t y(t)
d2ydt2 = diff(y,t,2);
F = 1 + 2*t^2 + 5*t^3;
sol = dsolve(m*d2ydt2 + k*y == F)
Hi,
Yes, as per the theory, there shouls not be any problem in solving my equation, but i don't know why i am getting that error message. May i request you to please run the code in your computer to see the error message.
Thanks
I can't run your code because I don't have MATLAB available at the moment.
Could you show the error message and the values for G, m, k and F ?
please see the error message given below:
Error using inlineeval (line 13)
Error in inline expression ==>
1.0.*sin(46.2910049886275730783283388292.*t).*vpaintegral(-(cos((115727512471568932695820847073.*x)./2500000000000000000000000000).*(6402403458187347020593357432393190.*sin((101810873033002558653881961495169.*x)./20000000000000000000000000000000)
-
546179499700870295093501927277764.*cos((101810873033002558653881961495169.*x)./20000000000000000000000000000000)
-
1091484589003228863893451655662330.*sin((101810873033002558653881961495169.*x)./10000000000000000000000000000000)
-
14652197704568398482045359802588300.*cos((76358154774751918990411471121377.*x)./5000000000000000000000000000000)
+
61224490313335945942482298220454400.*sin((76358154774751918990411471121377.*x)./5000000000000000000000000000000)
+
439337471999871317310206586388243.*cos((101810873033002558653881961495169.*x)./10000000000000000000000000000000)
-
65951879239871767044541090342172900000.*x.^2.*cos((76358154774751918990411471121377.*x)./5000000000000000000000000000000)
+
1021179888937533936684364911354740000000.*x.^3.*cos((76358154774751918990411471121377.*x)./5000000000000000000000000000000)
-
8028035727378310272557125038003060000000.*x.^4.*cos((76358154774751918990411471121377.*x)./5000000000000000000000000000000)
+
35550724306286333471646338459542500000000.*x.^5.*cos((76358154774751918990411471121377.*x)./5000000000000000000000000000000)
-
92520498847395516212870382871976600000000.*x.^6.*cos((76358154774751918990411471121377.*x)./5000000000000000000000000000000)
+
140306553435228340081781777864469000000000.*x.^7.*cos((76358154774751918990411471121377.*x)./5000000000000000000000000000000)
-
114693103068679059032508403832303000000000.*x.^8.*cos((76358154774751918990411471121377.*x)./5000000000000000000000000000000)
+
39045484473869952743353415302469300000000.*x.^9.*cos((76358154774751918990411471121377.*x)./5000000000000000000000000000000)
+
155754282456941843697559446256725000000.*x.^2.*sin((76358154774751918990411471121377.*x)./5000000000000000000000000000000)
-
2425853191000989977896153375570790000000.*x.^3.*sin((76358154774751918990411471121377.*x)./5000000000000000000000000000000)
+
21781356964794211536591522111734200000000.*x.^4.*sin((76358154774751918990411471121377.*x)./5000000000000000000000000000000)
-
118561196612148691490201310070665000000000.*x.^5.*sin((76358154774751918990411471121377.*x)./5000000000000000000000000000000)
+
402607961117914283972168030136777000000000.*x.^6.*sin((76358154774751918990411471121377.*x)./5000000000000000000000000000000)
-
856411213280765837702718994590495000000000.*x.^7.*sin((76358154774751918990411471121377.*x)./5000000000000000000000000000000)
+
1108041034517703679881104280994800000000000.*x.^8.*sin((76358154774751918990411471121377.*x)./5000000000000000000000000000000)
-
796763835597853219106567799352320000000000.*x.^9.*sin((76358154774751918990411471121377.*x)./5000000000000000000000000000000)
+
244121278663053738921129632073103000000000.*x.^10.*sin((76358154774751918990411471121377.*x)./5000000000000000000000000000000)
-
1230502519584595783029770760357980000.*x.^2.*cos((101810873033002558653881961495169.*x)./10000000000000000000000000000000)
+
11845234403004155834890686490256900000.*x.^3.*cos((101810873033002558653881961495169.*x)./10000000000000000000000000000000)
+
30085546750367659086779738334607200000.*x.^4.*cos((101810873033002558653881961495169.*x)./10000000000000000000000000000000)
-
623109845257055322553063455907660000000.*x.^5.*cos((101810873033002558653881961495169.*x)./10000000000000000000000000000000)
+
2516539022637835320302261988974710000000.*x.^6.*cos((101810873033002558653881961495169.*x)./10000000000000000000000000000000)
-
4569633735815542256718819414765540000000.*x.^7.*cos((101810873033002558653881961495169.*x)./10000000000000000000000000000000)
+
3911794722738409984170161434525880000000.*x.^8.*cos((101810873033002558653881961495169.*x)./10000000000000000000000000000000)
-
1265020573724590896280045727886460000000.*x.^9.*cos((101810873033002558653881961495169.*x)./10000000000000000000000000000000)
+
927059960588331554097714336775398000.*x.^2.*sin((101810873033002558653881961495169.*x)./10000000000000000000000000000000)
-
35166796979955955654073094605755000000.*x.^3.*sin((101810873033002558653881961495169.*x)./10000000000000000000000000000000)
+
143558290831986583782794512239254000000.*x.^4.*sin((101810873033002558653881961495169.*x)./10000000000000000000000000000000)
+
1344126534660948474237312262981710000000.*x.^5.*sin((101810873033002558653881961495169.*x)./10000000000000000000000000000000)
-
11971313348561850150917353255513400000000.*x.^6.*sin((101810873033002558653881961495169.*x)./10000000000000000000000000000000)
+
37540148663842513144816968016887900000000.*x.^7.*sin((101810873033002558653881961495169.*x)./10000000000000000000000000000000)
-
57763295653111344657176246535461000000000.*x.^8.*sin((101810873033002558653881961495169.*x)./10000000000000000000000000000000)
+
43528105637809464346041300333016900000000.*x.^9.*sin((101810873033002558653881961495169.*x)./10000000000000000000000000000000)
-
12668751241549162996356373248604100000000.*x.^10.*sin((101810873033002558653881961495169.*x)./10000000000000000000000000000000)
+
60810362129644725105076654065136900.*x.*cos((101810873033002558653881961495169.*x)./20000000000000000000000000000000)
-
549578223686936108677133713657247000.*x.*sin((101810873033002558653881961495169.*x)./20000000000000000000000000000000)
-
2219536364576181093018082113921390000.*x.^2.*cos((101810873033002558653881961495169.*x)./20000000000000000000000000000000)
+
28477566235514555469915502953668600000.*x.^3.*cos((101810873033002558653881961495169.*x)./20000000000000000000000000000000)
-
186238857748504878746810442921247000000.*x.^4.*cos((101810873033002558653881961495169.*x)./20000000000000000000000000000000)
+
697255434975759675144859396968014000000.*x.^5.*cos((101810873033002558653881961495169.*x)./20000000000000000000000000000000)
-
1535392819134858033596320978415000000000.*x.^6.*cos((101810873033002558653881961495169.*x)./20000000000000000000000000000000)
+
1933894354290850435151031254577310000000.*x.^7.*cos((101810873033002558653881961495169.*x)./20000000000000000000000000000000)
-
1258557091557755599386376147952150000000.*x.^8.*cos((101810873033002558653881961495169.*x)./20000000000000000000000000000000)
+
314371037182239654308949917153224000000.*x.^9.*cos((101810873033002558653881961495169.*x)./20000000000000000000000000000000)
+
1773851736763748746612772936147730000.*x.*cos((76358154774751918990411471121377.*x)./5000000000000000000000000000000)
+
14713433341096634183834052933580700000.*x.^2.*sin((101810873033002558653881961495169.*x)./20000000000000000000000000000000)
-
227005858497084592035255646610558000000.*x.^3.*sin((101810873033002558653881961495169.*x)./20000000000000000000000000000000)
+
1822754914563821428958471054903940000000.*x.^4.*sin((101810873033002558653881961495169.*x)./20000000000000000000000000000000)
-
8649742652031284303817737787810960000000.*x.^5.*sin((101810873033002558653881961495169.*x)./20000000000000000000000000000000)
+
25492921058899788602402176862240100000000.*x.^6.*sin((101810873033002558653881961495169.*x)./20000000000000000000000000000000)
-
46596469360770474725137668294843400000000.*x.^7.*sin((101810873033002558653881961495169.*x)./20000000000000000000000000000000)
+
50541996287809774703222031645701100000000.*x.^8.*sin((101810873033002558653881961495169.*x)./20000000000000000000000000000000)
-
29076726999190698594758812969322300000000.*x.^9.*sin((101810873033002558653881961495169.*x)./20000000000000000000000000000000)
+
6536686176038156669655992430074460000000.*x.^10.*sin((101810873033002558653881961495169.*x)./20000000000000000000000000000000)
-
5234676642442419048372367791913040000.*x.*sin((76358154774751918990411471121377.*x)./5000000000000000000000000000000)
-
16338490728267513636346593914937500.*x.*cos((101810873033002558653881961495169.*x)./10000000000000000000000000000000)
-
76863446679510377901616849470823700.*x.*sin((101810873033002558653881961495169.*x)./10000000000000000000000000000000)
+
46291004988627573078328338829199900))./10000000000000000000000000000000000,
x, 0, t) -
1.0.*cos(46.2910049886275730783283388292.*t).*vpaintegral(-(sin((115727512471568932695820847073.*x)./2500000000000000000000000000).*(6402403458187347020593357432393190.*sin((101810873033002558653881961495169.*x)./20000000000000000000000000000000)
-
546179499700870295093501927277764.*cos((101810873033002558653881961495169.*x)./20000000000000000000000000000000)
-
1091484589003228863893451655662330.*sin((101810873033002558653881961495169.*x)./10000000000000000000000000000000)
-
14652197704568398482045359802588300.*cos((76358154774751918990411471121377.*x)./5000000000000000000000000000000)
+
61224490313335945942482298220454400.*sin((76358154774751918990411471121377.*x)./5000000000000000000000000000000)
+
439337471999871317310206586388243.*cos((101810873033002558653881961495169.*x)./10000000000000000000000000000000)
-
65951879239871767044541090342172900000.*x.^2.*cos((76358154774751918990411471121377.*x)./5000000000000000000000000000000)
+
1021179888937533936684364911354740000000.*x.^3.*cos((76358154774751918990411471121377.*x)./5000000000000000000000000000000)
-
8028035727378310272557125038003060000000.*x.^4.*cos((76358154774751918990411471121377.*x)./5000000000000000000000000000000)
+
35550724306286333471646338459542500000000.*x.^5.*cos((76358154774751918990411471121377.*x)./5000000000000000000000000000000)
-
92520498847395516212870382871976600000000.*x.^6.*cos((76358154774751918990411471121377.*x)./5000000000000000000000000000000)
+
140306553435228340081781777864469000000000.*x.^7.*cos((76358154774751918990411471121377.*x)./5000000000000000000000000000000)
-
114693103068679059032508403832303000000000.*x.^8.*cos((76358154774751918990411471121377.*x)./5000000000000000000000000000000)
+
39045484473869952743353415302469300000000.*x.^9.*cos((76358154774751918990411471121377.*x)./5000000000000000000000000000000)
+
155754282456941843697559446256725000000.*x.^2.*sin((76358154774751918990411471121377.*x)./5000000000000000000000000000000)
-
2425853191000989977896153375570790000000.*x.^3.*sin((76358154774751918990411471121377.*x)./5000000000000000000000000000000)
+
21781356964794211536591522111734200000000.*x.^4.*sin((76358154774751918990411471121377.*x)./5000000000000000000000000000000)
-
118561196612148691490201310070665000000000.*x.^5.*sin((76358154774751918990411471121377.*x)./5000000000000000000000000000000)
+
402607961117914283972168030136777000000000.*x.^6.*sin((76358154774751918990411471121377.*x)./5000000000000000000000000000000)
-
856411213280765837702718994590495000000000.*x.^7.*sin((76358154774751918990411471121377.*x)./5000000000000000000000000000000)
+
1108041034517703679881104280994800000000000.*x.^8.*sin((76358154774751918990411471121377.*x)./5000000000000000000000000000000)
-
796763835597853219106567799352320000000000.*x.^9.*sin((76358154774751918990411471121377.*x)./5000000000000000000000000000000)
+
244121278663053738921129632073103000000000.*x.^10.*sin((76358154774751918990411471121377.*x)./5000000000000000000000000000000)
-
1230502519584595783029770760357980000.*x.^2.*cos((101810873033002558653881961495169.*x)./10000000000000000000000000000000)
+
11845234403004155834890686490256900000.*x.^3.*cos((101810873033002558653881961495169.*x)./10000000000000000000000000000000)
+
30085546750367659086779738334607200000.*x.^4.*cos((101810873033002558653881961495169.*x)./10000000000000000000000000000000)
-
623109845257055322553063455907660000000.*x.^5.*cos((101810873033002558653881961495169.*x)./10000000000000000000000000000000)
+
2516539022637835320302261988974710000000.*x.^6.*cos((101810873033002558653881961495169.*x)./10000000000000000000000000000000)
-
4569633735815542256718819414765540000000.*x.^7.*cos((101810873033002558653881961495169.*x)./10000000000000000000000000000000)
+
3911794722738409984170161434525880000000.*x.^8.*cos((101810873033002558653881961495169.*x)./10000000000000000000000000000000)
-
1265020573724590896280045727886460000000.*x.^9.*cos((101810873033002558653881961495169.*x)./10000000000000000000000000000000)
+
927059960588331554097714336775398000.*x.^2.*sin((101810873033002558653881961495169.*x)./10000000000000000000000000000000)
-
35166796979955955654073094605755000000.*x.^3.*sin((101810873033002558653881961495169.*x)./10000000000000000000000000000000)
+
143558290831986583782794512239254000000.*x.^4.*sin((101810873033002558653881961495169.*x)./10000000000000000000000000000000)
+
1344126534660948474237312262981710000000.*x.^5.*sin((101810873033002558653881961495169.*x)./10000000000000000000000000000000)
-
11971313348561850150917353255513400000000.*x.^6.*sin((101810873033002558653881961495169.*x)./10000000000000000000000000000000)
+
37540148663842513144816968016887900000000.*x.^7.*sin((101810873033002558653881961495169.*x)./10000000000000000000000000000000)
-
57763295653111344657176246535461000000000.*x.^8.*sin((101810873033002558653881961495169.*x)./10000000000000000000000000000000)
+
43528105637809464346041300333016900000000.*x.^9.*sin((101810873033002558653881961495169.*x)./10000000000000000000000000000000)
-
12668751241549162996356373248604100000000.*x.^10.*sin((101810873033002558653881961495169.*x)./10000000000000000000000000000000)
+
60810362129644725105076654065136900.*x.*cos((101810873033002558653881961495169.*x)./20000000000000000000000000000000)
-
549578223686936108677133713657247000.*x.*sin((101810873033002558653881961495169.*x)./20000000000000000000000000000000)
-
2219536364576181093018082113921390000.*x.^2.*cos((101810873033002558653881961495169.*x)./20000000000000000000000000000000)
+
28477566235514555469915502953668600000.*x.^3.*cos((101810873033002558653881961495169.*x)./20000000000000000000000000000000)
-
186238857748504878746810442921247000000.*x.^4.*cos((101810873033002558653881961495169.*x)./20000000000000000000000000000000)
+
697255434975759675144859396968014000000.*x.^5.*cos((101810873033002558653881961495169.*x)./20000000000000000000000000000000)
-
1535392819134858033596320978415000000000.*x.^6.*cos((101810873033002558653881961495169.*x)./20000000000000000000000000000000)
+
1933894354290850435151031254577310000000.*x.^7.*cos((101810873033002558653881961495169.*x)./20000000000000000000000000000000)
-
1258557091557755599386376147952150000000.*x.^8.*cos((101810873033002558653881961495169.*x)./20000000000000000000000000000000)
+
314371037182239654308949917153224000000.*x.^9.*cos((101810873033002558653881961495169.*x)./20000000000000000000000000000000)
+
1773851736763748746612772936147730000.*x.*cos((76358154774751918990411471121377.*x)./5000000000000000000000000000000)
+
14713433341096634183834052933580700000.*x.^2.*sin((101810873033002558653881961495169.*x)./20000000000000000000000000000000)
-
227005858497084592035255646610558000000.*x.^3.*sin((101810873033002558653881961495169.*x)./20000000000000000000000000000000)
+
1822754914563821428958471054903940000000.*x.^4.*sin((101810873033002558653881961495169.*x)./20000000000000000000000000000000)
-
8649742652031284303817737787810960000000.*x.^5.*sin((101810873033002558653881961495169.*x)./20000000000000000000000000000000)
+
25492921058899788602402176862240100000000.*x.^6.*sin((101810873033002558653881961495169.*x)./20000000000000000000000000000000)
-
46596469360770474725137668294843400000000.*x.^7.*sin((101810873033002558653881961495169.*x)./20000000000000000000000000000000)
+
50541996287809774703222031645701100000000.*x.^8.*sin((101810873033002558653881961495169.*x)./20000000000000000000000000000000)
-
29076726999190698594758812969322300000000.*x.^9.*sin((101810873033002558653881961495169.*x)./20000000000000000000000000000000)
+
6536686176038156669655992430074460000000.*x.^10.*sin((101810873033002558653881961495169.*x)./20000000000000000000000000000000)
-
5234676642442419048372367791913040000.*x.*sin((76358154774751918990411471121377.*x)./5000000000000000000000000000000)
-
16338490728267513636346593914937500.*x.*cos((101810873033002558653881961495169.*x)./10000000000000000000000000000000)
-
76863446679510377901616849470823700.*x.*sin((101810873033002558653881961495169.*x)./10000000000000000000000000000000)
+
46291004988627573078328338829199900))./10000000000000000000000000000000000,
x, 0, t) -
0.1.*cos(46.2910049886275730783283388292.*t)
+ 1./10
Undefined function 'vpaintegral' for
input arguments of type 'double'.
Error in inline/feval (line 33)
INLINE_OUT_ =
inlineeval(INLINE_INPUTS_,
INLINE_OBJ_.inputExpr,
INLINE_OBJ_.expr); %#ok<DILEVAL>
Error in ezplotfeval (line 53)
z = feval(f,x(1),y(1));
Error in ezplot>ezimplicit (line 266)
u = ezplotfeval(f, X, Y);
Error in ezplot (line 162)
hp = ezimplicit(cax,
f{1}, vars, labels,
args{:});
Error in sym/ezplot (line 78)
h =
ezplot(fhandle(f),varargin{:});%#ok<EZPLT>
Error in mathworksquestion (line
140)
ezplot(you,[tstart L/v])
Seems the error comes from the "ezplot" command, not from "dsolve".
output from dsolve contains "vpaintegral", therefore we are not able to plot it....
I want to know why output is in the form of vpaintegral...
Please run the code in your computer, it will take 5 minutes.
syms y(t)
Dy = diff(y,t)
equation = m*diff(y,t,2) + k*y == F
condtn1 = y(tstart) == G; condtn2 = Dy(tstart) == 0;
condition = [condtn1; condtn2]
sol_y_mass = dsolve(equation,condition)
you = G - sol_y_mass
youf = matlabFunction(you)
figure(101)
ezplot(youf,[tstart L/v])
hold on
xlim([0,tim(L/v)])
beep
Does this work ?
If not, please show the error message.
Hi,
Still the above solution is not working.
The New error message is given below:
Error using symengine
Error: Invalid text character.
Check for unsupported symbol,
invisible character, or pasting
of non-ASCII characters.
Error in symengine
Error in sym/matlabFunction (line
174)
g =
symengine('makeFhandle',varnames,body);
Error in MassMotion (line 8)
youf = matlabFunction(you)
Does
sol_y_mass = matlabFunction(sol_y_mass)
work ?
If yes, are there other variables except t that appear in the function handle ?
No, It did Not work.
There are no other variables except t in the function.
The best way to help is to run the code in your computer, if possible. :)
Thanks

Sign in to comment.

Answers (1)

Change the plotting to something like this:
tvec = linspace(tstart, L/v, 200);
Y = double(subs(you, t, tvec));
plot(tvec, Y)
hold on
xlim([0,(L/v)])
You will definitely not be able to get ezplot() to work.
You can try fplot() instead of ezplot(), but it would take rather a long time.

Categories

Find more on Mathematics and Optimization in Help Center and File Exchange

Products

Release

R2021a

Asked:

on 29 Mar 2022

Answered:

on 11 Apr 2022

Community Treasure Hunt

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

Start Hunting!