Unable to plot multiple fplot3 plots in a single figure window
Mostrar comentarios más antiguos
I want to plot these three bezier curves in a single figure window, But only the first one gets plotted whichever among the three is first written. 'biu' is a function which returns a scalar value coresponding to x, y and z coordinate.
fplot3(@(u) biu(6,u,answer6(i,:),1), @(u) biu(6,u,answer6(i,:),2), @(u) biu(6,u,answer6(i,:),3), [0,1]);
hold on
fplot3(@(u) biu(8,u,answer8(i,:),1), @(u) biu(8,u,answer8(i,:),2), @(u) biu(8,u,answer8(i,:),3), [0,1]);
fplot3(@(u) biu(10,u,answer10(i,:),1), @(u) biu(10,u,answer10(i,:),2), @(u) biu(10,u,answer10(i,:),3), [0,1]);
Also, a warning occurs while executing second and third fplot3.
Warning: Error updating ParameterizedFunctionLine.
The following error was reported evaluating the function in FunctionLine update: Matrix dimensions
must agree.
> In defaulterrorcallback (line 12)
In continous_plot (line 26)
I am attaching the following executable code:
1;
clear
answer6 = [0.100000000000000 -6.21416331569629e-24 -4.50067222307376e-22 2.74750257593135e-23 0.190477327063510 -6.21416331569630e-24 -4.50067222307376e-22 -10.9260818385908 0.250945795757658 -0.0451689735762751 0.0283457843799247 4.03424843193981 0.173917713362077 -0.140836185200614 -0.390991522770315 -0.605005655409602 -0.0406952485790888 -0.174065964740236 0.371284463498887 -2.84477235804700 0.196423091290018 -3.53805043409145e-23 4.00422535274886e-22 0.180754593067727 0.900000000000000 -3.53805043409148e-23 4.00422535274886e-22 0];
answer8 = [0.100000000000000 -7.06472172696455e-22 -1.72925923497761e-20 -6.97358948464362e-22 0.177119941643678 -7.06472172696457e-22 -1.72925923497761e-20 -26.7913589675177 -0.0246464915517595 -0.00262781158023573 -0.000248137776663395 18.5819139350985 0.792166611629705 0.00592149397069832 -0.0575361342079896 -23.9883460477526 0.212949051718266 0.618648449540250 0.264002935566575 1.05316519470157 0.608822639612242 -0.468662052642181 -0.943037679532112 0.123977640513716 0.542232586158068 -0.180255361839493 0.539315234478191 -6.25709650240297 0.565731359548267 -3.16930293664645e-20 -2.73778470569392e-21 -0.212430190468469 0.900000000000000 -3.16930293664646e-20 -2.73778470569392e-21 0];
answer10 = [0.100000000000000 7.44976336488981e-26 -2.72925178012477e-25 0 0.341660364019771 -8.36334207627696e-26 6.03638566286587e-25 -0.0821226164675251 -0.116018472518371 0.275797408817403 0.483984092069014 0.357820148354801 -0.309601667970325 -0.427475712037463 -0.861659197808978 -2.75583808235523 1.33580907738058 0.348144691156665 0.871698466222378 0.918537941545163 -1.28737948991171 -0.146081700272931 -0.588205568764831 1.44289605927306 1.14034147857000 -0.00384025271401972 0.242081990228206 -17.1532035902660 -0.711184991677660 0.0123546743275213 -0.0714870713918044 9.86110330591459 1.46372097562677 -0.00978612652148374 0.0133995593293546 -5.07578699742636 -0.0228631835799416 3.00318624836592e-24 1.22747896244737e-23 0.0698643052915244 0.900000000000000 2.17310703266423e-24 -7.62659438731673e-25 0];
s = length(answer6(:,1));
figure();
for i=1:s
fplot3(@(u) biu(6,u,answer6(i,:),1), @(u) biu(6,u,answer6(i,:),2), @(u) biu(6,u,answer6(i,:),3), [0,1]);
hold on
fplot3(@(u) biu(8,u,answer8(i,:),1), @(u) biu(8,u,answer8(i,:),2), @(u) biu(8,u,answer8(i,:),3), [0,1]);
fplot3(@(u) biu(10,u,answer10(i,:),1), @(u) biu(10,u,answer10(i,:),2), @(u) biu(10,u,answer10(i,:),3), [0,1]);
hold off
end
function b = biu(n,u,r,d)
persistent NC NCI
if isempty(NC)
NCI=zeros(n+1,1);
for i=0:n
NCI(i+1) = nchoosek(n,i);
end
NC=1;
end
b=0;
for i=0:n
b=b+NCI(i+1)*(u.^i).*(1-u).^(n-i).*r(4*i+1:4*i+4);
end
if d~=0
b=b(d);
end
end
2 comentarios
darova
el 17 de Mzo. de 2020
Please attach necessary data to run your code
Shobhit Singhal
el 18 de Mzo. de 2020
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre 2-D and 3-D Plots en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
