need help to plot function contain condition 'equal '
Mostrar comentarios más antiguos
Hello every one,
I need to plot this function of pentagonal, which is

and the figure must as:

I try it but the output of figure not as the Required drawing ,
if any prof. can help me thanks alot,
thank you
Respuesta aceptada
Más respuestas (1)
Walter Roberson
el 30 de Ag. de 2021
piecewise() if you have the Symbolic Toolbox.
If you do not have the Symbolic Toolbox, then use logical indexing, such as
mask = a4 <= x & x <= a5
y(mask) = s * (a5 - x(mask) )./(a5 - a4);
Caution: all of your middle endpoints occur multiple times. The value for x == a3 is defined three different ways. The first and second way are not compatible. for x == a3, then (x - a2)/(a3-a2) would be (a3-a2)/(a3-a2) = 1, and that would be multiplied by (1-r) would would give (1-r) . Then 1 minus that is 1 - (1-r) which would be r, which is not the same as the third case where the output has to be 1 when x == a3.
Look as well at the second case when x == a2 . (x-a2)/(a3-a2) when x == a2 would be (a2-a2)/(a3-a2) which would be 0. That would be multiplied by (1-r) giving 0. That would be subtracted from 1, giving 1. That is incompatible with the first expression and incompatible with the diagram, both of which require that the output be r at x == a2.
2 comentarios
hasan s
el 30 de Ag. de 2021
Categorías
Más información sobre Numerical Integration and Differentiation 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!
