Skip to content

Commit 764dbfb

Browse files
authored
Merge pull request #45 from Yukti-09/patch-2
Create Piecewise(without inbuilt).m
2 parents f56c5d9 + 83db67b commit 764dbfb

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
%piecewise function without using inbuilt func
2+
y = @(x) (1).*((x >= 1/2)) + (x).*((-1/2<x) & (x < 1/2)) + (0).*((x<=-1/2));
3+
x = -10:0.01:10;
4+
fplot(y);
5+
xlabel('x');
6+
ylabel('y');
7+
grid on

0 commit comments

Comments
 (0)