Finding points of intersection between Curve and sides of a square
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
clc
clear all
close all
S = 2;
a = 0.1
b = 0.2
p_crd = [0,S]
p_x = [((1+S)/2)+a S+0.5 S+0.5 ((1+S)/2) ((1+S)/2)];
p_y = [(1+S)/2 (1+S)/2 S+0.5 S+0.5 ((S+1)/2)+b];
plate = plot(p_x,p_y);
n =15;
axis([0,3,0,3]);
hold on
theta = linspace(0,pi/2,1000);
h = 1.5;
k = 1.5;
del = linspace(0,((S)/sqrt(2))-0.25,n)
for i = 1:n
hold on
a2 = a+del(i);
b2 = b+del(i);
x{i} = h + a2*cos(theta);
y{i} = k + b2*sin(theta);
plot(x{i},y{i});
end
axis square
As you can see, I want the ellipses to be restricted within the sides of square and know their intersecting points. I tried the inpolygon function but it resulted in lines within the square but not upto the side of the square plate. If someone can please help, it would be highly appreciated.
0 commentaires
Réponses (1)
Matt J
le 11 Déc 2021
If you make the appropriate change of coordinates, your ellipses will become circles and your square will become a more general polygon. You can then use the methods discussed in this similar thread.
0 commentaires
Voir également
Catégories
En savoir plus sur Smoothing dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
