Important General Idea
To be sure to know well the basic principles of a scilab / matlab function handling:
A function is a relation between groups of numbers. For each x value you have up to one y value. For an example, y=3x has domain in any real number and ranges to any real number, which means x=1 has y=3, x=0.002 has y=0.006, etc.
But in scilab and matlab, we need to define each data point for which the program will relate x and y, i.e. we work with discrete data, which you are doing well with linspace. So we have a finite group of x values for which we intend to get y values. That is important to keep in mind. This means if we specify x as the linspace you mentioned, x=0.1 does not exist, and the "resolution" or "differential step" for x is 1 (x varies 1 by 1 each value).
Now, if you are in a hurry, go for the codes I put in each section.
Help command
Type in scilab terminal the command:
help functionName
This, combined with googling "scilab funcionName" or "scilab taskDefinition" will super expand your self-reliance into learning matlab or scilab. If you're in a hurry using help, go for the code examples available in the window it opens. Suggested commands for you:
help linspace
help plot
help log
help factorial
help for
help grid
Plotting
for f2(x) = logn I've understand you intend to plot a log(n) function = f2(n).
To declare a number of values for x axis in scilab, the below solutions will return the same line matrix of discrete data:
n = linspace(1,50,50);
or
x = 1 : 1 : 50;
You may remove the ; at the end of the command to check it's return.
Now, into plotting:
plot(log(n))
The code above uses the plot function passing the returned values of another function as parameter (log), which itself receives as parameter the variable n you just declared (if you did the linspace command line exemplified). If it fails, maybe you declared x instead of n to receive the linspace or range of values.
I suggest you also try the code:
close //closes other opened graph window. All text after // is a comment and won't run
figure; //creates a graph window
subplot(2,1,1) // creates and selects an area in the figure handler
title("f(n) = log n")
plot(log(n)); //draws graph into available selected area. Auto-opens figure if necessary
subplot(2,1,2) //selects second area of blocks 2 rows vs 1 column to plot
title("f(n) = n")
plot(n);
The above code solves for f2 and f3, I suppose. Simpler alternative:
figure,
a=log(n);
plot(a)
figure,
plot(n)
For f4(n) = nlogn you can't multiply the row matrices n and log(n), so we need to create a new line matrix and populate with the result of n*log(n).
close //use this as much as you please, or manually close other windows
n=1:1:50;
a=log(n);
b=n;
f4=zeros(1,50) //I took the ; so you see the inintial result
for i=1:1:50 //for each i value from 1 to 50, incrementing i by 1 each time
f4(i) = a(i) * b(i); //each i data point of f4 becomes i data point from a multiplied by i data point from b
end
plot(f4)
For f6= nj (j > 2) you didn't specify j, so for an example if j(x) = sin(x), try
close
x = 2:1:50; //defines range for x > 2
j = sin(x); //defines j in same range as sin(x values)
figure,
title("f6(n) = n*j, j=sin(n), {f6, n} > 2 ")
f6 = zeros(1,49);
for i=1:1:49
f6(i) = x(i)*j(i);
end
plot(f6)
xlabel("n") //use help xlabel if curious
ylabel("f6(n)")
Same idea for f7.
For f8 you might use
close
x = linspace(1, 50, 50);
f8 = factorial(x);
plot(f8)
You might need a zoom there, or reducing linspace range, as factorial values raise very fast.
Extra Tip
There is decent chance some known math functions like factorial are defined in scilab. I didn't know that function, though, so I googled "scilab factorial". Help is also available to try out.