how to make a patch using normal vector?

5 views (last 30 days)
Sierra
Sierra on 28 May 2022
Answered: Ishu on 30 Oct 2023
I made patch and connect them. so I could make a someting like a tube.
but the result(first image) is not what i intended to make.
I want to have a patch like a second image using normal vector.
let me know how to make a patch using normval vector.
thanks!

Answers (1)

Ishu
Ishu on 30 Oct 2023
Hi Sierra,
I understand that you want to plot a patch over some already plotted graphs means you want to overlay a patch.
To plot a patch using a normal vector you can use "patch()" function. As you have not provided the data so I will not be able to plot your graph but a general example of the implementaion of "patch()" is show below.
x = [1, 2, 1, 3, 1, 4, 1, 5, 1, 6, 1, 7, 1, 8, 1, 9, 1, 10];
y = [1, 4, 1, 2, 1, 8, 1, 5, 1, 3, 1, 9, 1, 7, 1, 6, 1, 10];
% Plot lines
plot(x, y);
x_patch = [1, 6, 6.5, 1];
y_patch = [1, 4, 9, 1];
% plot patch
patch( x_patch, y_patch, 'k', 'Facecolor', 'none');
xlabel('X');
ylabel('Y');
You can change the data according to your needs and can plot a patch as you want.
For more information of "patch()" function you can refer to the below documentaion:
Hope if helps.

Community Treasure Hunt

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

Start Hunting!