Email: [email protected]

This Portal for internal use only!

  • My Download
  • Checkout
Application Package Repository Telkom University
All Categories

All Categories

  • IBM
  • Visual Paradigm
  • Adobe
  • Google
  • Matlab
  • Microsoft
    • Microsoft Apps
    • Analytics
    • AI + Machine Learning
    • Compute
    • Database
    • Developer Tools
    • Internet Of Things
    • Learning Services
    • Middleware System
    • Networking
    • Operating System
    • Productivity Tools
    • Security
    • VLS
      • Office
      • Windows
  • Opensource
  • Wordpress
    • Plugin WP
    • Themes WP
  • Others

Search

0 Wishlist

Cart

Categories
  • Microsoft
    • Microsoft Apps
    • Office
    • Operating System
    • VLS
    • Developer Tools
    • Productivity Tools
    • Database
    • AI + Machine Learning
    • Middleware System
    • Learning Services
    • Analytics
    • Networking
    • Compute
    • Security
    • Internet Of Things
  • Adobe
  • Matlab
  • Google
  • Visual Paradigm
  • WordPress
    • Plugin WP
    • Themes WP
  • Opensource
  • Others
More Categories Less Categories
  • Get Pack
    • Product Category
    • Simple Product
    • Grouped Product
    • Variable Product
    • External Product
  • My Account
    • Download
    • Cart
    • Checkout
    • Login
  • About Us
    • Contact
    • Forum
    • Frequently Questions
    • Privacy Policy
  • Forum
    • News
      • Category
      • News Tag

iconTicket Service Desk

  • My Download
  • Checkout
Application Package Repository Telkom University
All Categories

All Categories

  • IBM
  • Visual Paradigm
  • Adobe
  • Google
  • Matlab
  • Microsoft
    • Microsoft Apps
    • Analytics
    • AI + Machine Learning
    • Compute
    • Database
    • Developer Tools
    • Internet Of Things
    • Learning Services
    • Middleware System
    • Networking
    • Operating System
    • Productivity Tools
    • Security
    • VLS
      • Office
      • Windows
  • Opensource
  • Wordpress
    • Plugin WP
    • Themes WP
  • Others

Search

0 Wishlist

Cart

Menu
  • Home
    • Download Application Package Repository Telkom University
    • Application Package Repository Telkom University
    • Download Official License Telkom University
    • Download Installer Application Pack
    • Product Category
    • Simple Product
    • Grouped Product
    • Variable Product
    • External Product
  • All Pack
    • Microsoft
      • Operating System
      • Productivity Tools
      • Developer Tools
      • Database
      • AI + Machine Learning
      • Middleware System
      • Networking
      • Compute
      • Security
      • Analytics
      • Internet Of Things
      • Learning Services
    • Microsoft Apps
      • VLS
    • Adobe
    • Matlab
    • WordPress
      • Themes WP
      • Plugin WP
    • Google
    • Opensource
    • Others
  • My account
    • Download
    • Get Pack
    • Cart
    • Checkout
  • News
    • Category
    • News Tag
  • Forum
  • About Us
    • Privacy Policy
    • Frequently Questions
    • Contact
Home/Matlab/Changing from 2D plot to 3D plot and to STL file

Changing from 2D plot to 3D plot and to STL file

PuTI / 2025-06-29
Changing from 2D plot to 3D plot and to STL file
Matlab News

Hello everyone, I have these following codes: All of them creates a 2D plot, now I really want to create a 3D plot with Z: the thickness of plot XY. Then I want to convert it to STL file.
clc;
clear all;
close all;
% Input
R0 = 0.15;
a = 25*pi/180;
theta = 0:pi/1000:3*pi;
theta2 = theta + pi;
delta = pi/2;
%% Curl 1
R1 = R0*exp(a*(theta-delta));
X1 = R1.*cos(theta-delta);
Y1 = R1.*sin(theta-delta);
%% Curl 2
R2 = R0*exp(a*(theta-delta));
X2 = R2.*cos(theta);
Y2 = R2.*sin(theta);
%% Curl 3
R3 = R0*exp(a*(theta2-delta));
X3 = R1.*cos(theta2-delta);
Y3 = R1.*sin(theta2-delta);
%% Curl 4
R4 = R0*exp(a*(theta2 – delta));
X4 = R2.*cos(theta2);
Y4 = R2.*sin(theta2);
%% Extra plot (arc)
radius = R0*exp(a*(3*pi-pi/2));
a1 = pi/2;
b1 = pi;
h = 0;
k = 0;
t1 = linspace(a1,b1,3001);
X_arc1 = radius*cos(t1) + h;
Y_arc1 = radius*sin(t1) + k;

a2 = -pi/2;
b2 = 0;
t2 = linspace(a2,b2,3001);
X_arc2 = radius*cos(t2) + h;
Y_arc2 = radius*sin(t2) + k;

R5 = 0.05;
X5 = R5.*cos(theta);
Y5 = R5.*sin(theta);
%% Plot
figure(1);
plot(X1,Y1, ‘k’, ‘LineWidth’, 3); hold on
plot(X2,Y2, ‘k’, ‘LineWidth’, 3); hold on

P1 = plot(X_arc1, Y_arc1, ‘k’);
set(P1,’linewidth’,3);
axis([h-radius-1 h+radius+1 k-radius-1 k+radius+1])
axis square; hold on;

plot(X3,Y3, ‘k’, ‘LineWidth’, 3);hold on
plot(X4,Y4, ‘k’, ‘LineWidth’, 3);hold on
plot(X5,Y5, ‘k’, ‘LineWidth’, 3); hold on

P2 = plot(X_arc2, Y_arc2, ‘k’);
set(P2,’linewidth’,3);
axis(‘equal’);
title(‘Two-arm equiangular spiral antenna’, ‘fontsize’,14, ‘fontweight’,’bold’);
hold on
%% Filling with black color
patch([X1; flipud(X2)], [Y1; flipud(Y2)],’k’);
patch([X3; flipud(X4)], [Y3; flipud(Y4)],’k’);

X_arc1_bonus = horzcat(X_arc1, -4, -2.2, -2, -1, -0.3);
Y_arc1_bonus = horzcat(Y_arc1, 0.8, 2.2, 2.6, 3, 3.2);
fill(X_arc1_bonus, Y_arc1_bonus,’k’);

X_arc2_bonus = horzcat(X_arc2, 4, 2.2, 2, 1, 0.3);
Y_arc2_bonus = horzcat(Y_arc2, -0.8, -2.2, -2.6, -3, -3.2);
fill(X_arc2_bonus, Y_arc2_bonus,’k’);Hello everyone, I have these following codes: All of them creates a 2D plot, now I really want to create a 3D plot with Z: the thickness of plot XY. Then I want to convert it to STL file.
clc;
clear all;
close all;
% Input
R0 = 0.15;
a = 25*pi/180;
theta = 0:pi/1000:3*pi;
theta2 = theta + pi;
delta = pi/2;
%% Curl 1
R1 = R0*exp(a*(theta-delta));
X1 = R1.*cos(theta-delta);
Y1 = R1.*sin(theta-delta);
%% Curl 2
R2 = R0*exp(a*(theta-delta));
X2 = R2.*cos(theta);
Y2 = R2.*sin(theta);
%% Curl 3
R3 = R0*exp(a*(theta2-delta));
X3 = R1.*cos(theta2-delta);
Y3 = R1.*sin(theta2-delta);
%% Curl 4
R4 = R0*exp(a*(theta2 – delta));
X4 = R2.*cos(theta2);
Y4 = R2.*sin(theta2);
%% Extra plot (arc)
radius = R0*exp(a*(3*pi-pi/2));
a1 = pi/2;
b1 = pi;
h = 0;
k = 0;
t1 = linspace(a1,b1,3001);
X_arc1 = radius*cos(t1) + h;
Y_arc1 = radius*sin(t1) + k;

a2 = -pi/2;
b2 = 0;
t2 = linspace(a2,b2,3001);
X_arc2 = radius*cos(t2) + h;
Y_arc2 = radius*sin(t2) + k;

R5 = 0.05;
X5 = R5.*cos(theta);
Y5 = R5.*sin(theta);
%% Plot
figure(1);
plot(X1,Y1, ‘k’, ‘LineWidth’, 3); hold on
plot(X2,Y2, ‘k’, ‘LineWidth’, 3); hold on

P1 = plot(X_arc1, Y_arc1, ‘k’);
set(P1,’linewidth’,3);
axis([h-radius-1 h+radius+1 k-radius-1 k+radius+1])
axis square; hold on;

plot(X3,Y3, ‘k’, ‘LineWidth’, 3);hold on
plot(X4,Y4, ‘k’, ‘LineWidth’, 3);hold on
plot(X5,Y5, ‘k’, ‘LineWidth’, 3); hold on

P2 = plot(X_arc2, Y_arc2, ‘k’);
set(P2,’linewidth’,3);
axis(‘equal’);
title(‘Two-arm equiangular spiral antenna’, ‘fontsize’,14, ‘fontweight’,’bold’);
hold on
%% Filling with black color
patch([X1; flipud(X2)], [Y1; flipud(Y2)],’k’);
patch([X3; flipud(X4)], [Y3; flipud(Y4)],’k’);

X_arc1_bonus = horzcat(X_arc1, -4, -2.2, -2, -1, -0.3);
Y_arc1_bonus = horzcat(Y_arc1, 0.8, 2.2, 2.6, 3, 3.2);
fill(X_arc1_bonus, Y_arc1_bonus,’k’);

X_arc2_bonus = horzcat(X_arc2, 4, 2.2, 2, 1, 0.3);
Y_arc2_bonus = horzcat(Y_arc2, -0.8, -2.2, -2.6, -3, -3.2);
fill(X_arc2_bonus, Y_arc2_bonus,’k’); Hello everyone, I have these following codes: All of them creates a 2D plot, now I really want to create a 3D plot with Z: the thickness of plot XY. Then I want to convert it to STL file.
clc;
clear all;
close all;
% Input
R0 = 0.15;
a = 25*pi/180;
theta = 0:pi/1000:3*pi;
theta2 = theta + pi;
delta = pi/2;
%% Curl 1
R1 = R0*exp(a*(theta-delta));
X1 = R1.*cos(theta-delta);
Y1 = R1.*sin(theta-delta);
%% Curl 2
R2 = R0*exp(a*(theta-delta));
X2 = R2.*cos(theta);
Y2 = R2.*sin(theta);
%% Curl 3
R3 = R0*exp(a*(theta2-delta));
X3 = R1.*cos(theta2-delta);
Y3 = R1.*sin(theta2-delta);
%% Curl 4
R4 = R0*exp(a*(theta2 – delta));
X4 = R2.*cos(theta2);
Y4 = R2.*sin(theta2);
%% Extra plot (arc)
radius = R0*exp(a*(3*pi-pi/2));
a1 = pi/2;
b1 = pi;
h = 0;
k = 0;
t1 = linspace(a1,b1,3001);
X_arc1 = radius*cos(t1) + h;
Y_arc1 = radius*sin(t1) + k;

a2 = -pi/2;
b2 = 0;
t2 = linspace(a2,b2,3001);
X_arc2 = radius*cos(t2) + h;
Y_arc2 = radius*sin(t2) + k;

R5 = 0.05;
X5 = R5.*cos(theta);
Y5 = R5.*sin(theta);
%% Plot
figure(1);
plot(X1,Y1, ‘k’, ‘LineWidth’, 3); hold on
plot(X2,Y2, ‘k’, ‘LineWidth’, 3); hold on

P1 = plot(X_arc1, Y_arc1, ‘k’);
set(P1,’linewidth’,3);
axis([h-radius-1 h+radius+1 k-radius-1 k+radius+1])
axis square; hold on;

plot(X3,Y3, ‘k’, ‘LineWidth’, 3);hold on
plot(X4,Y4, ‘k’, ‘LineWidth’, 3);hold on
plot(X5,Y5, ‘k’, ‘LineWidth’, 3); hold on

P2 = plot(X_arc2, Y_arc2, ‘k’);
set(P2,’linewidth’,3);
axis(‘equal’);
title(‘Two-arm equiangular spiral antenna’, ‘fontsize’,14, ‘fontweight’,’bold’);
hold on
%% Filling with black color
patch([X1; flipud(X2)], [Y1; flipud(Y2)],’k’);
patch([X3; flipud(X4)], [Y3; flipud(Y4)],’k’);

X_arc1_bonus = horzcat(X_arc1, -4, -2.2, -2, -1, -0.3);
Y_arc1_bonus = horzcat(Y_arc1, 0.8, 2.2, 2.6, 3, 3.2);
fill(X_arc1_bonus, Y_arc1_bonus,’k’);

X_arc2_bonus = horzcat(X_arc2, 4, 2.2, 2, 1, 0.3);
Y_arc2_bonus = horzcat(Y_arc2, -0.8, -2.2, -2.6, -3, -3.2);
fill(X_arc2_bonus, Y_arc2_bonus,’k’); 2d plot to 3d plot MATLAB Answers — New Questions

​

Tags: matlab

Share this!

Related posts

Random Forest with paired observations: how to maintain subject separation
2025-07-08

Random Forest with paired observations: how to maintain subject separation

Why is uiaxes small by default in a uifigure?
2025-07-08

Why is uiaxes small by default in a uifigure?

For the trainNetwork function, progress plots for training are not closing, except if done manually. How do I close it? I have tried close all, close force, close(fig), & more
2025-07-08

For the trainNetwork function, progress plots for training are not closing, except if done manually. How do I close it? I have tried close all, close force, close(fig), & more

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Search

Categories

  • Matlab
  • Microsoft
  • News
  • Other
Application Package Repository Telkom University

Tags

matlab microsoft opensources
Application Package Download License

Application Package Download License

Adobe
Google for Education
IBM
Matlab
Microsoft
Wordpress
Visual Paradigm
Opensource

Sign Up For Newsletters

Be the First to Know. Sign up for newsletter today

Application Package Repository Telkom University

Portal Application Package Repository Telkom University, for internal use only, empower civitas academica in study and research.

Information

  • Telkom University
  • About Us
  • Contact
  • Forum Discussion
  • FAQ
  • Helpdesk Ticket

Contact Us

  • Ask: Any question please read FAQ
  • Mail: [email protected]
  • Call: +62 823-1994-9941
  • WA: +62 823-1994-9943
  • Site: Gedung Panambulai. Jl. Telekomunikasi

Copyright © Telkom University. All Rights Reserved. ch

  • FAQ
  • Privacy Policy
  • Term