Hey guys, I'm doing two questions for an assignment in MATLAB. The questions are:
(A) Produce a box shape as shown in Figure 2 using a 3D line plot. The 8
corner points of the box are as shown, i.e. (1,1,1), (1,2,1), (2,2,1), (2,1,1),
(1,1,4), (1,2,4), (2,2,4), (2,1,4).
B. Produce the above box shape using a user defined MATLAB function.
Name the MATLAB function as box_studentID (eg. box_1234567).
The 8 corner points of the box are (1,1,h1), (1,2, h1), (2,2, h1), (2,1, h1),
(1,1, h2), (1,2, h2), (2,2, h2), (2,1, h2). The inputs to the function are h1 and
h2; and the function does not need to return any value. Submit this as a
separate function m-file. Use this function m-file to produce the figure in
above step (A) using appropriate input values.
[The figure is basically a box with each corner with part (A)'s coordinates, all connected by blue lines]
Hmm looks like you need some experience using what ever software your being taught to use to answer this, seems like a pretty specific question, I wish I could help but I have no experience in this kind of coding, sorry.
After rereading your question I realized that my post probably isn't helpful. You can change the color of the * by using the formatting sample I suggested. Like '-*g'
Is this a matlab programming course? Or a math class?
Without knowing what it is you need to do. I'd solve the problem by defining a linear space, solving the line equation between the points and filling the linear space with points on the line, then plotting these points.
Part b should be simple once you're done with part a. You just pack your code into a function block, name the file the same thing and you can call the command from the terminal in Matlab.
After rereading your question I realized that my post probably isn't helpful. You can change the color of the * by using the formatting sample I suggested. Like '-*g'
Is this a matlab programming course? Or a math class?
Without knowing what it is you need to do. I'd solve the problem by defining a linear space, solving the line equation between the points and filling the linear space with points on the line, then plotting these points.
Part b should be simple once you're done with part a. You just pack your code into a function block, name the file the same thing and you can call the command from the terminal in Matlab.
Its on matlab.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
(A) Produce a box shape as shown in Figure 2 using a 3D line plot. The 8
corner points of the box are as shown, i.e. (1,1,1), (1,2,1), (2,2,1), (2,1,1),
(1,1,4), (1,2,4), (2,2,4), (2,1,4).
B. Produce the above box shape using a user defined MATLAB function.
Name the MATLAB function as box_studentID (eg. box_1234567).
The 8 corner points of the box are (1,1,h1), (1,2, h1), (2,2, h1), (2,1, h1),
(1,1, h2), (1,2, h2), (2,2, h2), (2,1, h2). The inputs to the function are h1 and
h2; and the function does not need to return any value. Submit this as a
separate function m-file. Use this function m-file to produce the figure in
above step (A) using appropriate input values.
[The figure is basically a box with each corner with part (A)'s coordinates, all connected by blue lines]
So atm, for part A i've managed to get this:
x1 = 1
x2 = 1
x3 = 2
x4 = 2
x5 = 1
x6 = 1
x7 = 2
x8 = 2
y1 = 1
y2 = 2
y3 = 2
y4 = 1
y5 = 1
y6 = 2
y7 = 2
y8 = 1
z1 = 1
z2 = 1
z3 = 1
z4 = 1
z5 = 4
z6 = 4
z7 = 4
z8 = 4
plot3(x1,y1,z1,x2,y2,z2,x3,y3,z3,x4,y4,z4,x5,y5,z5,x6,y6,z6,x7,y7,z7,x8,y8,z8)
and/or this
x = [1 1 2 2 1 1 2 2];
y = [1 2 2 1 1 2 2 1];
z = [1 1 1 1 4 4 4 4];
plot3(x,y,z,'*');
but I cannot get the blue lines. Does anyone know how I can fix this to get the blue lines please?
For part B - I have no clue what to do lol.
Please and Thank You to anyone who can give me a helping hand. =)
Thanks for responding. =)
Plot(pts, "b")
The last argument to plot commands is typically the formatting of the line.
Is this a matlab programming course? Or a math class?
Without knowing what it is you need to do. I'd solve the problem by defining a linear space, solving the line equation between the points and filling the linear space with points on the line, then plotting these points.
Part b should be simple once you're done with part a. You just pack your code into a function block, name the file the same thing and you can call the command from the terminal in Matlab.
Its on matlab.