## 10 Reputation

7 years, 126 days

## How can I animate this stiff function?...

Maple

Hi,

I have a problem with creating a function contains n-dimensional independent variables with random function .. The function looks like:

where U is a random between 0 and 1

For 1-dimensional problem, it will be like:

The plot by MATLAB will be:

While, for 2-dimensional problem, it will be like:

and the plot with MATLAB will be:

The MATLAB code is:

x1min=-5;
x1max=5;
x2min=-5;
x2max=5;
R=1000; % steps resolution
x1=x1min:(x1max-x1min)/R:x1max;
x2=x2min:(x2max-x2min)/R:x2max;

for j=1:length(x1)

% For 1-dimensional plotting
f1(j)=rand*abs(x1(j));

% For 2-dimensional plotting
for i=1:length(x2)
fn(i)=f1(j)+rand*abs(x2(i))^2;
end

fn_tot(j,:)=fn;

end

figure(1)
plot(x1,f1);

figure(2)
meshc(x1,x2,fn_tot);

I have used Maple because of its great graphics and animation, and for the mathematical analysis capability. However, to animate the above problem for 1- and 2-dimensional problems, I always fail!

My attempt has been just successed to plot 1-dimensional problem (without animation) .. And it tooks long-time with many codes!

restart;

X := Statistics:-RandomVariable(('Uniform')(0, 1));
R := Statistics:-Sample(X, 1000);

Vect := abs(Vector[column]([seq(0 .. 10, 10/999)]));

V := `~`[`-`](Vect, 5);

with(LinearAlgebra);
Mat := Multiply(V, R);

with(ArrayTools);
f := ArrayTools:-Diagonal(Mat);

F := abs(f);

Axis := Transpose(V);

f5 := plot(Axis, F, style = line);

And finally I got the graph:

But the problem is:

How can I animate it? Maybe I need to express it with new Maple code?

How can I plot and animate it when n=2?

Thanks

 Page 1 of 1
﻿