How to plot this function ? - Programmers Heaven

#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

#### Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

# How to plot this function ?

Posts: 4Member
My function is;

y(x,s)= 1-(cos[(s-1)arctan(x)]*gamma(s-1))/(1+x^2)^(s-1)/2

varible x will have range from 0 to 10. At one time the s value will be constant e.g. s = 3 but I want to change s for different values( is there any commands in matlab that will allow me to do this ?). I tried many time but can't get it.

• Posts: 217Member
You can define
[code]x=0:0.01:10[/code]
and y=....
if s is constant you can plot this by using the plot(x,y) function.

If s changes, probably you will have different curves to plot in the same plot (probably with different colors).
So, insert the y definition in a for loop:
for s=3:6
y=...
plot(x,y); hold on;
end