I need to know what function to use here?

As an architect working at a firm, you receive an email from a returning client asking for a floor plan for a postmodern installation:
“Dear Jamie Doe,
We are very happy with your design for our new gallery and we thought that an additional installation might compliment it. Can you please design it following the requirements below:
(i) The ground floor should be octagonal and all sides should be 4 metres from the centre; (ii) 8 smaller octagonal floors where all sides are 1 metre away from their centre; (iii) These 8 floors must be equidistant from the ground floor’s centre; (iii) These 8 floors’ centres must be 3 metres away from the ground floor’s centre; (iv) These 8 floors’ walls must align with the borders of the ground floor;
(v) A final square shaped floor to be placed in the centre of the ground floor where all the sides are 1 metre away from the centre.
We just need to see the shapes of the floor plan from a top-view, there is no need for taking into account
the support beams.
Kind regards,
OtherFirm PLC”
Design the floor plan as required by your client on MATLAB.

2 comentarios

Bob Thompson
Bob Thompson el 29 de En. de 2019
Could you post your code, or how you think things should start, so we can help you from there?
Mark Sherstan
Mark Sherstan el 29 de En. de 2019
MATLAB Answers is a place you can get help from the user community on specific MATLAB questions. It is not intended as a place to have strangers do your homework for you.
Desiring help with homework is fine, but:
  • show what you have done so far (post some code and explain what you are thinking about how to solve the problem).
  • ask a specific question about either specific MATLAB syntax/constructs, or general guidance (such as "what functions should I look at to achieve [result]")
  • make sure your question is answerable. A non-answerable question looks like, "How can I use MATLAB for Image Processing."
If you need help with the very basics of MATLAB, please read the getting started documentation.

Iniciar sesión para comentar.

 Respuesta aceptada

Guillaume
Guillaume el 29 de En. de 2019
Editada: Guillaume el 29 de En. de 2019

1 voto

Certainly, the problem is easy to solve using nsidedpoly. 5 lines of code (1 line for the anonymous function that converts wall distance to circumscribed radius, 3 lines for the 3 kind of floors, 1 line for calling plot) were all that was required to produce:
Do I get the job?
Note that you haven't asked an actual question. You just reposted your assignment verbatim.

14 comentarios

dd62
dd62 el 29 de En. de 2019
thank you a lot , can you please tell me what you did exactly to get the shapes?
dd62
dd62 el 29 de En. de 2019
or can you please send the code?
Guillaume
Guillaume el 29 de En. de 2019
As I wrote, I used nsidedpoly (and a call to polyshape.rotate for the smaller octagons)
dd62
dd62 el 29 de En. de 2019
okay thanks
sally z
sally z el 30 de En. de 2019
can someone provide the code
Guillaume
Guillaume el 30 de En. de 2019
As per Mark's comment to the question, we're not going to provide the solution to a homework problem. That's cheating and you don't learn anything from it. Now, if you've made an attempt at solving the problem and are struggling with a specific point, we can help. But you'll have to show us what you've done and ask a specific question.
t = (1/16:1/8:1)'*2*pi;
x1 = cos(t)+3.5;
y1 = sin(t);
x2 = cos(t)+2.5;
y2 = sin(t)-2.5;
x3 = cos(t);
y3 = sin(t)+3.5;
x4 = cos(t);
y4 = sin(t)-3.5;
x5 = cos(t)+2.5;
y5 = sin(t)+2.5;
x6 = cos(t)-3.5;
y6 = sin(t);
x7 = cos(t)-2.5;
y7 = sin(t)+2.5;
x8 = cos(t)-2.5;
y8 = sin(t)-2.5;
x = 4.8*cos(t);
y = 4.8*sin(t);
plot(x,y,x1,y1,x2,y2,x3,y3,x4,y4,x5,y5,x6,y6,x7,y7,x8,y8)
fill(x,y,'c',x1,y1,'w',x2,y2,'w',x3,y3,'w',x4,y4,'w',x5,y5,'w',x6,y6,'w', x7,y7,'w',x8,y8,'w')
axis square
r = rectangle('Position',[-1 -1 2 2]')
plot(r)
sally z
sally z el 30 de En. de 2019
the problem we are facing is that notice the height is not exactly 8
Bob Thompson
Bob Thompson el 30 de En. de 2019
Editada: Bob Thompson el 30 de En. de 2019
The simplest way to determine what your constant multiplications are is to work backwards from the values of t. For example you know that the outermost octagon must have edges at 4. So if we consider x = C * cos(t), then we know t(4) is part of the left most edge of the octagon. So if we want x = 4, then set 4 = C * cos(t(4)) and solve for C. You should get an answer of approximately 4.33. This same method will work for all of the other constants.
Also, before anybody else mentions it, I find that indexing my variables is much smoother than having a series of numbered variables. It just helps keep things more organized, and makes accessing the elements simpler.
x(1) = cos(t)+3.5;
y(1) = sin(t);
x(2) = cos(t)+2.5;
y(2) = sin(t)-2.5;
x(3) = cos(t);
y(3) = sin(t)+3.5;
x(4) = cos(t);
y(4) = sin(t)-3.5;
x(5) = cos(t)+2.5;
y(5) = sin(t)+2.5;
....
dd62
dd62 el 30 de En. de 2019
the big octagon has to have its points from 0,4 and 0,-4 at the bottom
dd62
dd62 el 30 de En. de 2019
we are trying to do that but it's not working
Bob Thompson
Bob Thompson el 30 de En. de 2019
See my edited response.
dd62
dd62 el 30 de En. de 2019
thank you
Guillaume
Guillaume el 30 de En. de 2019
As I said, use nsidedpoly. The only thing you have to work out is the radius of the circumscribed circle which is a trivial bit of trigonometry. For the 8 inner octagon, you also need to rotate them. Again working out the rotation angles is trivial.

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Preguntada:

el 29 de En. de 2019

Comentada:

el 30 de En. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by