# Plot a curve on vertical axis

4 visualizaciones (últimos 30 días)
federico nutarelli el 20 de Sept. de 2021
Comentada: federico nutarelli el 20 de Sept. de 2021
Hi all,
I am producin the following image (the red arrows and the red circles are added artificially using a picture software to let you better understand the question):
The plot above has been produceed with the following mwe code:
clear
percorso=1;
angle_in_degrees=75;
l=2*pi;
if percorso ==1
%da 0 a pi-epsilon
s_bar = l/(2*abs(cos(theta)));
s_bar=l/(2*abs(sin(theta)));
s_bar=l/(2*abs(sin(theta)));
s_bar = l/(2*abs(cos(theta)));
s_bar=l/(2*abs(sin(theta)));
s_bar = l/(2*abs(cos(theta)));
s_bar = l/(2*abs(cos(theta)));
s_bar = l/(2*abs(sin(theta)));
end
elseif percorso==0
theta=0;
s_bar = l/(2*abs(cos(theta)));
end
N=250; %frequenza di campionamento (ho 150 campioni)
Delta_s0 = s_bar/N;
Delta_s2 = Delta_s0;
epsilon=l/100;
Delta_s1 = epsilon*(pi/2)/N;
s0a =0;
s0b = s_bar-epsilon;
s1a=s0b+Delta_s1;
s1b= s0b+epsilon*(pi/2);
s2a=s1b+Delta_s2;
s2b=s1b+s_bar-epsilon;
s0=[s0a:Delta_s0:s0b];
s1=[s1a:Delta_s1:s1b];
s2=[s2a:Delta_s2:s2b];
s_cat = [s0 s1 s2];
tratto = zeros(1,size(s_cat,2));
for k=1:size(s0,2)
tratto(:,k)=1;
end
for k=size(s0,2)+1:size(s0,2)+size(s1,2)
tratto(:,k)=2;
end
for k=size(s0,2)+size(s1,2)+1:size(s0,2)+size(s1,2)+size(s2,2)
tratto(:,k)=3;
end
primo_tratto = find(tratto==1);
secondo_tratto = find(tratto==2);
terzo_tratto = find(tratto==3);
conto1 = 1;
conto2 =1;
%%% SBAGLIATO IL TRATTO??? (è rimasto 0 da qualche parte??)
for m=1:size(s_cat,2) %numero di elementi di s
if m<=primo_tratto(size(primo_tratto,2)) %qui devo mettere m! (devo mettere un find fino a quando tratto è ==1)
elseif m>primo_tratto(size(primo_tratto,2)) && m<=secondo_tratto(size(secondo_tratto,2))
conto1=conto1+1;
elseif m>secondo_tratto(size(secondo_tratto,2)) && m<=terzo_tratto(size(terzo_tratto,2))
conto2=conto2+1;
end
end
What I would like to do is written on the image and is basically reproducing the "smoothed angle" on the top right corner also on the top so that the image looks like this (red curved line with, however radius epsilon as in the mwe. It shoul basically be exactly the same angle as the smoothed below but "reversed"):
##### 2 comentariosMostrar NingunoOcultar Ninguno
darova el 20 de Sept. de 2021
Is this the result you want to achieve?
federico nutarelli el 20 de Sept. de 2021
Editada: federico nutarelli el 20 de Sept. de 2021
@darova thank you for replying. Yes but the angle above, differently from the one below is 45 degrees. Also the angle in the top left should be smoothed. Basically, I am striving at finding the correct angle for the polar coordinates. Thank you very much

Iniciar sesión para comentar.

### Respuestas (1)

darova el 20 de Sept. de 2021
Editada: darova el 20 de Sept. de 2021
a = 30; % left corner angle
L = 10; % triangle size
r = 1; % arc radius
t1 = 0:90+a; % top corner arc
t2 = 90+a:270; % left corner arc
t3 = 270:360; % bottom right corner arc
y1 = y1 + L*sind(a); % translate first arc to top
x2 = x2 - L*cosd(a); % translate second arc to right
x = [x1 x2 x3 x1(1)];
y = [y1 y2 y3 y1(1)];
plot(x,y,'.-r')
axis equal
##### 1 comentarioMostrar -1 comentarios más antiguosOcultar -1 comentarios más antiguos
federico nutarelli el 20 de Sept. de 2021
thank you @darova. COuld you please try out with my code? Since I am working in a team I should align with the notation used. Thank you very much

Iniciar sesión para comentar.

### Categorías

Más información sobre Smoothing en Help Center y File Exchange.

R2020b

### Community Treasure Hunt

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

Start Hunting!

Translated by