필터 지우기
필터 지우기

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