Author Topic: New to Matlab need help with plotting conditinal functions >.<  (Read 1348 times)

Offline MastaMinds

  • Newbie
  • *
  • Posts: 2
  • Matlab Forum
    • View Profile
Hello there..
I am pretty new to MatLab and I started with basics and I was trying to plot a conditional function that has a value that changes according to ranges of x but when ever I try I either get an error or the program plots the function I typed after the else part only and I dont want that >.<
I have brought some pics of that and if someone could help I would be so grateful
(http://www.0zz0.com)


(http://www.0zz0.com)


Thank you

Offline retTriamFam

  • Banned
  • *
  • Posts: 1
  • Matlab Forum
    • View Profile
Re: New to Matlab need help with plotting conditinal functions &gt;.&lt;
« Reply #1 on: September 07, 2011, 04:02:47 PM »
hello there and thank you for your info – I’ve definitely picked up something new from right here. Recenzje filmowe (http://) I did however expertise some technical issues using this site, as I experienced to reload the site many times previous to I could get it to load properly. I had been wondering if your web hosting is OK? Not that I am complaining, but sluggish loading instances times will often affect your placement in google and could damage your quality score if ads and marketing with Adwords. Anyway I am adding this RSS to my email and can look out for much more of your respective exciting content. Make sure you update this again soon..
« Last Edit: September 07, 2011, 08:09:17 PM by Matlab »

Offline isa farhadi

  • Newbie
  • *
  • Posts: 7
  • Matlab Forum
    • View Profile
    • MATLAB in Petroleum Engineering
Re: New to Matlab need help with plotting conditinal functions >.<
« Reply #2 on: February 16, 2012, 12:48:45 PM »
you can use this codes:
  x=linspace(0,2);
SF=zeros(1,100);
for i=1:100
    if x(i)<0.5
    SF(i)=5;
    elseif (x(i)<=1.5) && (x(i)>=0.5)
    SF(i)=0;
    else     SF(i)=-5;
    end
end
plot(x,SF) 

Matlab and SimuLink Development Forum

Re: New to Matlab need help with plotting conditinal functions >.<
« Reply #2 on: February 16, 2012, 12:48:45 PM »