Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
VPA > While converting from 'sym': The conversion returned a value of class 'matlab.mixin.Heterogeneous', which cannot be inserted into an array of class 'matlab.graphics.illustration.ColorBar'.
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi,
This interesting error is caused from the following code:
x0 = [.1, .1];
options = optimoptions('fsolve','Display','iter');
dt=0.01;
Nt=0.1/dt+1;
Tarray = [0:dt:0.1];
T = 0;
for nt=1:Nt
T=T+dt;
X = sym('x', [1,2]);
F = torder1(X,T);
sols = vpasolve(F, X);
h(nt) = sols.x1;
theta(nt) = sols.x2;
end
for nt=1:Nt
plot(Tarray,h(nt),'*')
hold on
plot(Tarray,theta(nt),'+')
end
This uses below function
function F=torder1(x,T)
x_1=[0:0.01:1];
b=0.6;
clear x_1;
syms x_1 h theta
kappa =1;
f_11 = 1-( (h+(x_1-b)*theta)^2/(h+(x_1-b)*theta-1*x_1*(1-x_1))^2 );
f_21 = (x_1-b)/2*( 1-( (h+(1-b)*theta)^2/(h+(x_1-b)*theta-x_1*(1-x_1))^2 ));
fint_1 = int(f_11, x_1);
fint_2 = int(f_21, x_1);
x_1=1;
upper_1=subs(fint_1);
upper_2=subs(fint_2);
clear x_1;
x_1=0;
lower_1=subs(fint_1);
lower_2=subs(fint_2);
clear x_1;
integral_1old=upper_1-lower_1;
integral_2old=upper_2-lower_2;
h0 = kappa *b*(1-b);
theta0 = kappa*(1-2*b);
integral_1 = subs(integral_1old, {h, theta}, {x(1), x(2)});
integral_2 = subs(integral_2old, {h, theta}, {x(1), x(2)});
F = [vpa(x(1) - integral_1*T^2 -h0); vpa(x(2) - integral_2*T^2 - theta0)];
I know the error is related to the index of my for loop (nt).
Any help will be appreciated. Thanks.
0 Kommentare
Antworten (0)
Diese Frage ist geschlossen.
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!