how to plot a two-dimensional heaviside function
15 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi, everybody! I'm trying to plot some heaviside function like that:
x=0:1000;
y=0:500;
z=0:25;
R=25*(heaviside(x-40)-heaviside(x-240))*(heaviside(y-40)-heaviside(y-160));
but I always get an error sound like
error using * Inner matrix dimensions must agree.
I was trying to rewrite an expression like this:
R=25*(heaviside(x-40)-heaviside(x-240)).*(heaviside(y-40)-heaviside(y-160));
but I've got the same mistake with using .*.... What can you suggest? And also how to plot functions like that?
0 Kommentare
Antworten (1)
Azzi Abdelmalek
am 13 Aug. 2014
Bearbeitet: Azzi Abdelmalek
am 13 Aug. 2014
x=0:1000;
y=0:500;
z=0:25;
a=25*(heaviside(x-40)-heaviside(x-240)),
b=(heaviside(y-40)-heaviside(y-160));
out=bsxfun(@times,a.',b)
Siehe auch
Kategorien
Mehr zu Annotations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!