Info

此问题已关闭。 请重新打开它进行编辑或回答。

Problem generating genric 3-d shapes

1 次查看(过去 30 天)
IISc
IISc 2015-8-19
关闭: MATLAB Answer Bot 2021-8-20
Hello, I am working on an obstacle avoidance problem for an unmanned system. I need to generate a 3-d plot wherein i wish to place objects of various shapes and sizes.
Based on attached file information i prepared a code as follows
function [x,y,z] = obstac
clc
clear all
k1 = 1;
k2 = 1;
k3 = 1;
k4 = 1;
rho = 6;
x = -1:0.1:1;
y = -1:0.1:1;
lenx = length(x);
leny = length(y);
z = zeros(leny,lenx);
for i = 1:lenx
for j = 1:leny
z(j,i) = fzero(@(z)normal(rho,x(i),y(j),z,k1,k2,k3,k4),z(j,i));
end
end
surface(x,y,-z)
function f = normal(rho,x,y,z,k1,k2,k3,k4)
xc = 0;
yc = 0;
zc = 0;
bs = 100;
f = norm([(x-xc)/(k1+bs); (y-yc)/(k2+bs); (z-zc)/(k3+bs)],rho) - k4^rho ;
But i am not able to get the results as shown above. I wish to know following what is wrong with my code. I shall be very grateful if someone can help me create various 3-d shapes using a generic routine as above. regards, Tarun Uppal

回答(0 个)

此问题已关闭。

产品

Community Treasure Hunt

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

Start Hunting!

Translated by