How to create a semicircular pulse function?
Mostrar comentarios más antiguos
I need to write a function that adds a rectangularPulse, a triangularPulse and a semicircular pulse, but i can't find a way to do this. All the answers I find here plots directly the semicircle, but it doesn't create a function that i can add to others and it isn't a pulse.
Basically, what I'm trying to do is:
syms x
p = 4*rectangularPulse(-4,4,x);
a = (-pi)*triangularPulse(0,2,x);
c = (-1)*semicircularPulse(-4,0,x); %% where -4 is the rising edge of the pulse, 0 is the falling edge and the radius is 2. (|-4+0|/2)
fun = p + a + c;
fplot(fun, [-5 5])
But I still couldn't figure how I'm going to do this semicircularPulse function.
Thank you.
Respuestas (1)
Image Analyst
el 2 de Dic. de 2018
0 votos
4 comentarios
Matheus Angelo
el 2 de Dic. de 2018
Image Analyst
el 2 de Dic. de 2018
Really? OK so I took the FAQ and put in your numbers and it seemed to work fine:
% Define parameters of the arc.
xCenter = -2;
yCenter = 0;
radius = 2;
% Define the angle theta as going from 0 to 180 degrees in 100 steps.
theta = linspace(0, 180, 100);
% Define x and y using "Degrees" version of sin and cos.
x = radius * cosd(theta) + xCenter;
c = radius * sind(theta) + yCenter;
% Now plot the points.
plot(x, c, 'b-', 'LineWidth', 2);
axis equal;
grid on;
xlabel('x', 'FontSize', 20);
ylabel('c', 'FontSize', 20);

Let me see your code so I can tell what you did wrong.
Matheus Angelo
el 4 de Dic. de 2018
Image Analyst
el 4 de Dic. de 2018
I don't have the Symbolic toolbox so all I can do is to do it numerically.
Basically just make a function that ignores the signal and makes an array that is all zero except it's 1 at x=0. Or make two ramps if there are lots of x values.
But your first question didn't seem to say that you wanted to transform the circle into a triangle. It seemed to say you need to create three differently shaped signals and simply add them together. So which is it?
- Create three signals and add together, or
- Make a transform that makes any signal into that triangle?
Categorías
Más información sobre Mathematics en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
