I apologize for asking this, I believe this is a simple task, but I don't know how to do it.
Suppose I have a formula y = (exp(-x) + x^2)/sqrt(pi(x) and I want to plot it as y versus x^2.
How does one do this?
Like this:
X = 0:0.1:5; %// Get the x values
x = X.^2; %// Square them
%// Your formula had errors, I fixed them but I could have misinterpreted here, please check
y = (exp(-x) + x.^2)./sqrt(pi*x); %// Calculate y at intervals based on the squared x. This is still y = f(x), I'm just calculating it at the points at which I want to plot it.
plot(x,y) %//Plot against the square X.
At this point this is no different to having just plotted it normally. What you want is to make the tickmarks go up in values of X.^2. This does not change the y-values nor distort the function, it just changes what it looks like visually. Similar to plotting against a log scale:
set(gca, 'XTick', X.^2) %//Set the tickmarks to be squared
The second method gives you a plot like

edit:
Actually I think you were asking for this:
x = 0:0.1:5;
y = x.^2; %// Put your function in here, I'm using a simple quadratic for illustrative purposes.
plot(x.^2,y) %//Plot against the square X. Now your y values a f(x^2) which is wrong, but we'll fix that later
set(gca, 'XTick', (0:0.5:5).^2) %//Set the tickmarks to be a nonlinear intervals
set(gca, 'XTickLabel', 0:0.5:5) %//Cahnge the labels to be the original x values, now accroding to the plot y = f(x) again but has the shape of f(x^2)
So here I'm plotting a simple quadratic, but if I plot it against a squared x it should become linear. However I still want to read off the graph that y=x^2, not y=x, I just want it to look like y=x. So if I read the y value for the x value of 4 on that graph i will get 16 which is still the same correct original y value.

y = (exp(-X + X.^2)./sqrt(pi*X); i.e. y is a function of x and not x^2?x this way, you're just plotting points for x.^2 so that you get the correct y value for each x value on the plot.y as a function of x^2, not x, which I think is incorrect. You can calculate y as a function of x, but plot it as a function of x^2.X = 0:0.1:5; x = X.^2; y = (exp(-x) + x.^2)./sqrt(pi*x); Y = (exp(-X) + X.^2)./sqrt(pi*X); plot(X,Y); plot(x,y); figure(2); set(gca, 'XTick', x); You can see that if you zoom in on the second plot they are the same. It's still a function of x just calculated at non-linear intervals.plot(X,y,X,Y), the two curves aren't the same. (X,Y) is the correct one, (X,y) is wrong.Here's my answer: it is similar to Dan's one, but fundamentally different. You can calculate the values of y as a function of x, but plot them as a function of x^2, which is what the OP was asking, if my understanding is correct:
x = 0:0.1:5; %// Get the x values
x_squared = x.^2; %// Square them
%// Your formula had errors, I fixed them but I could have misinterpreted here, please check
y = (exp(-x) + x.^2)./sqrt(pi*x); %// Calculate y based on x, not the square of x
plot(x_squared,y) %//Plot against the square of x
As Dan mentioned, you can always change the tickmarks:
x_ticks = (0:0.5:5).^2; % coarser vector to avoid excessive number of ticks
set(gca, 'XTick', x_ticks) %//Set the tickmarks to be squared

y=f(x^2), not y=f(x). When x^2 is 4, then x is 2 and y is around 1.65.X^2 not calculate it based on x^2. It's just like changing an axis to a log scale instead of linear. The values shouldn't change. Just the plot.set(gca, 'XTickLabel', 0:0.5:5) and then I will say that this is the correct answer.
.s for element-wise operations and alsopi(x)is highly unlikely what you mean. Please fix these.