Fixing the error: ??? Error using ==> line Size mismatch in Param Cell / Value Cell pair
1 次查看(过去 30 天)
显示 更早的评论
Hi friends
I wrote the following code in order to reduce the number of edges based on the method:
but the error
??? Error using ==> line Size mismatch in Param Cell / Value Cell pair
occurred.
the code:
t=linspace(-pi/8,pi/8,800);
r=linspace(0,1,800);
[t, r]=meshgrid(t, r);
z=(0.2079921258e1 .* (cos((4 .* t)) .^ 2 .* ((4 .* r .^ 3 - 2 .* r) .^ 2) ./ 0.144e3 + sin((4 .* t)) .^ 2 .* ((r .^ 4 - r .^ 2) .^ 2) ./ (r .^ 2) ./ 0.9e1) ./ (-0.1361305280e0 .* cos((4 .* t)) .* (r .^ 4 - r .^ 2) + 0.1e1) + 0.1e1) ./ (-0.1361305280e0 .* cos((4 .* t)) .* (r .^ 4 - r .^ 2) + 0.1e1);
[x,y,z]=pol2cart(t,r,z);
h=surfc(x,y,z,'facecolor','interp','edgecolor','none');
xlabel('X');ylabel('Y');zlabel('Z')
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%Divide the lengths by the number of lines needed
xsize=length(get(h,'Xdata'))/10; % 10 lines
ysize=length(get(h,'Ydata'))/10; % 10 partitions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%get X,Y and Z data from surface Plot
x=get(h,'Xdata');
y=get(h,'Ydata');
z=get(h,'zdata');
hold on
%%%%Make sure the dimensions are always correct based on surface plot data
%%%%PLOTTING Lines in the X-Z plane
for i = 1:ysize:length(get(h,'Ydata'))
Y1(1:length(get(h,'Ydata'))) = y(i);
X1=x(:);
Z1=z(i,:);
line(X1,Y1,Z1,'color','black') ;
end
%%%%PLOTTING Lines in the Y-Z plane
for i = 1:xsize:length(get(h,'Xdata'))
X2(1:length(get(h,'Xdata')))=x(i);
Y2=y(:);
Z2=z(:,i);
line(X2,Y2,Z2,'color','black') ;
end
Can anyone help me please! If you know please answer to my question as simple as you can.
Thanks a lot
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!