KEMBAR78
Heaviside Function: X y On 'X Axis' 'Y Axis' On Off | PDF | Teaching Methods & Materials
0% found this document useful (0 votes)
32 views2 pages

Heaviside Function: X y On 'X Axis' 'Y Axis' On Off

The document plots the curves (x^2 + y^2)^4 == (x^2 - y^2)^2 and x^2 - y^2 over the range [-1 1] using ezplot and sets labels and grid lines.

Uploaded by

Fakhar Abbas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views2 pages

Heaviside Function: X y On 'X Axis' 'Y Axis' On Off

The document plots the curves (x^2 + y^2)^4 == (x^2 - y^2)^2 and x^2 - y^2 over the range [-1 1] using ezplot and sets labels and grid lines.

Uploaded by

Fakhar Abbas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

syms x y

ezplot((x^2 + y^2)^4 == (x^2 - y^2)^2, [-1 1])


hold on
xlabel('x axis')
ylabel('y axis')
grid on
hold off

es, the Heaviside function is 0.5 at zero this gives it the appropriate mathematical
properties. You can shift it to compare values other than zero. This is a standard technique.
In Matlab R2012a+, you can take advantage of assumptions in addition to the normal
relational operators. To add to @AlexB's comment, you should convert the output of any
logical comparison to symbolic before using isAlways:
isAlways(sym(x<0))
In your case, x is obviously not "always" on one side or the other of zero, but you may still
find this useful in other cases.

/ 0 if x < 0,

m(x) = | -2x(x - 3/2) if 0 x < 1,

| 1 + (x - 1) if 1 x < 3/2,

\ x - 1/4 if x 3/2.

So in matlab if I have some variable x with some values, i.e.

x = -1:0.01:2;

then I can formulate the above as:

m = ...

(0 ) .* (x < 0 ) + ...

(-2*x.^2.*(x-3/2)) .* (0 <= x & x < 1 ) + ...

(1+(x-1).^2 ) .* (1 <= x & x < 3/2) + ...

(x-1/4 ) .* (x >= 3/2 );


Now, I can show a plot:

plot(x,m);

syms t

y1=t^2

y2=t^2-16

fg=figure

ax=axes;

ez1=ezplot(char(y1),[-8,8])

hold on

ez2=ezplot(char(y2),[-8,8])

legend('y1=t^2','y2=t^2-16')

set(ez1,'color',[1 0 0])

title(ax,['y1=t^2' ' y2=t^2-16'])

syms g h t
assume(g > 0)
solve(h == g*t^2/2, t)

assume(x < -1 | x > 1)


solve(x^5 - (565*x^4)/6 - (1159*x^3)/2 - (2311*x^2)/6 + (365*x)/2 + 250/3, x)

You might also like