Error using plot Data must be numeric, datetime, duration or an array convertible to double
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Hi,
May someone please clarify to me on how i can clear the above error message. i have tried using subs(), double() with no success. Anyway i am a basic MATLAB user.
x=[1680 1190 841 595 420 297 210 149 105 74.4 52.5 37.2 26.3 18.6 13.1 9.29 6.57 4.65 3.28 ...
2.32 1.64 1.16 0.821 0.581 0.00];
y=[99.872 98.945 95.538 88.050 76.599 62.936 49.281 37.107 27.087 19.425 13.696 9.996 7.296 5.325 ...
3.886 2.837 2.070 1.511 1.103 0.805 0.588 0.429 0.313 0.228 0.000];
a=3.79; b=3.31; c=0.36; d=0.54; f=1.11; g=0.24;Dc=0.5; h=1.5; Di=0.1; Do=0.083; Du=0.058; H=3; fi=0.198;
S=a*(Du/Do)^6*(Du^2+Do^2)^c*h^d*exp(0.54*fi)/(Dc^f*H^g);
F=50;
Rv=S/(S+1);
a1=2.69*10^3; b1=0.46; c1=0.6; d1=1.21; f1=0.71; g1=0.38; i1=0.45; ps=1841.525; pf=1000; Q=0.09352;
d50c=a1*Dc^b1*Di^c1*Do^d1*exp(6.3*fi)/(Du^f1*h^g1*Q^i1*(ps-pf)^0.5);
a2=2.96; b2=0.15;
lambda=a2*(Dc^2*h/Q)^b2*exp(-1.58*Rv);
x1=x./d50c;
edp=1-exp(-0.693.*x1.^lambda);
syms x y
summation=symsum(edp.*y/100*F);
Rf=(Rv-fi)*summation;
alpha=Rf;
cdp=alpha+(1-alpha).*edp;
Rs=symsum(cdp.*y./100*F);
pio=(1-cdp*y*F)./(symsum((1-cdp.*y*F)));
piu=(cdp*y*F)./(symsum((cdp.*y*F)));
plot(cdp,Rs);
0 comentarios
Respuestas (2)
Shadaab Siddiqie
el 25 de Feb. de 2021
From my understanding you are getting an error with above code. Please solve the expressions before plotting it. Please refer symbolic expression and solve for more information.
Steven Lord
el 25 de Feb. de 2021
Let's look at what you're trying to plot.
x=[1680 1190 841 595 420 297 210 149 105 74.4 52.5 37.2 26.3 18.6 13.1 9.29 6.57 4.65 3.28 ...
2.32 1.64 1.16 0.821 0.581 0.00];
y=[99.872 98.945 95.538 88.050 76.599 62.936 49.281 37.107 27.087 19.425 13.696 9.996 7.296 5.325 ...
3.886 2.837 2.070 1.511 1.103 0.805 0.588 0.429 0.313 0.228 0.000];
a=3.79; b=3.31; c=0.36; d=0.54; f=1.11; g=0.24;Dc=0.5; h=1.5; Di=0.1; Do=0.083; Du=0.058; H=3; fi=0.198;
S=a*(Du/Do)^6*(Du^2+Do^2)^c*h^d*exp(0.54*fi)/(Dc^f*H^g);
F=50;
Rv=S/(S+1);
a1=2.69*10^3; b1=0.46; c1=0.6; d1=1.21; f1=0.71; g1=0.38; i1=0.45; ps=1841.525; pf=1000; Q=0.09352;
d50c=a1*Dc^b1*Di^c1*Do^d1*exp(6.3*fi)/(Du^f1*h^g1*Q^i1*(ps-pf)^0.5);
a2=2.96; b2=0.15;
lambda=a2*(Dc^2*h/Q)^b2*exp(-1.58*Rv);
x1=x./d50c;
edp=1-exp(-0.693.*x1.^lambda);
syms x y
summation=symsum(edp.*y/100*F);
Rf=(Rv-fi)*summation;
alpha=Rf;
cdp=alpha+(1-alpha).*edp;
Rs=symsum(cdp.*y./100*F);
pio=(1-cdp*y*F)./(symsum((1-cdp.*y*F)));
piu=(cdp*y*F)./(symsum((cdp.*y*F)));
% plot(cdp,Rs);
cdp
Rs
Okay, those are long expressions. Let's approximate them:
vpa(cdp, 5)
vpa(Rs, 5)
Now at what x and y coordinates should the ninth point (as an example) be plotted?
vpa([cdp(9), Rs(9)], 5)
Should it be left or right of the origin?
xcoord = double(subs(cdp(9), y, [1, -100]))
If you meant to use the x and y vectors defined at the start of your code to evaluate cdp and Rs, don't redefine x and y as symbolic variables in the middle of your code or define those vectors with other names and maybe use subs to substitute those into the symbolic expressions you're trying to plot. The fact that your v vector is not a scalar may cause problems, though, in trying to get the correctly sized output. It's not clear to me what you're trying to do (no comments in your code) so I can't offer any further guidance.
Ver también
Categorías
Más información sobre Assumptions en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!