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