MATLAB Answers

How I can to realize this function

6 views (last 30 days)
Gertruda Radomir
Gertruda Radomir on 7 Nov 2020
Commented: Rik on 7 Nov 2020
This question was flagged by John D'Errico
Hello to everyone!
I need help in solving this function, please!

  2 Comments

John D'Errico
John D'Errico on 7 Nov 2020
When you edit your question away, you insult those who apparently wasted their time in answering your question, since now their answer is useless to anyone else.
Rik
Rik on 7 Nov 2020
Unfortunately for Vladislav Tepper, Google keeps a cache. So If you want to cheat, you will have to be a bit more cunning. Or not post on a public forum.
How I can to realize this function
Hello to everyone!
I need help in solving this function, please!
I tried to solve it with different methods, but nothing worked.
here is my last solution which doesn't work either.

Sign in to comment.

Answers (2)

KSSV
KSSV on 7 Nov 2020

n = 1:20 ;
y = zeros(size(n)) ;
y(n<=5) = n(n<=5).^2 ;
stem(n,y)

  0 Comments

Sign in to comment.


Alan Stevens
Alan Stevens on 7 Nov 2020
Use indexing:
Parabula = @(n) n.^2;
n = -2:6;
y = Parabula(n);
y(n<1 | n>5) = 0;
stem(n,y)
axis([-10 10 0 30])

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!