Dear all. I'm trying to create a 3D plot with surf function. The code is:
M=A/B;
v(1,:)=u01;
for n=2:length(t)
for j=1:length(x)
v(n,j)=M(n-1,j)*v(n-1,j)';
end
end
figure(1)
surf(x,t,v)
M is a matrix 201x201, t is a vector 1x101 .and x is another vector 1x201. u01 is an initial condition and it is 1x201. So, there aren't syntax error but the plot is uncorrected. I attach the file. Thanks all.

7 Kommentare

KSSV
KSSV am 10 Dez. 2016
What is size of v?
Giacomo Lucidi
Giacomo Lucidi am 10 Dez. 2016
hi :) v is 101x201
Star Strider
Star Strider am 10 Dez. 2016
Please describe what you want to do.
All we have is code that does not work as you want it to. We have no idea what it is supposed to do.
Giacomo Lucidi
Giacomo Lucidi am 10 Dez. 2016
Bearbeitet: Giacomo Lucidi am 10 Dez. 2016
v(n,j)=M(n-1,j)*v(n-1,j)';
This is the final solution for resolve the implicit method of Backward Eulero. I would simply create a 3D plot of this solution. If is necessary I can post the entire script. But I think that it isn't necessary because the previous part is all about the matrix's creation and the definition of initial conditions. Thanks!! ps I attach the file of the Backward Eulero for the transport equation. Now I have to compute the B.E. for diffusion equation.
Giacomo Lucidi
Giacomo Lucidi am 10 Dez. 2016
I have also this warning from Matlab: "Matrix is singular, close to singular or badly scaled. Results may be inaccurate. RCOND = NaN."
Image Analyst
Image Analyst am 10 Dez. 2016
Get rid of the excess black lines by setting the edge color to none:
surf(x,t,v, 'EdgeColor', 'none');
Other than that, I can't run your code because there are too many variables undefined, like M, A, B, u01, and t. If you want my help, you'll have to supply code I can run.
Giacomo Lucidi
Giacomo Lucidi am 10 Dez. 2016
I attach my script. Thanks for your time.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Gefragt:

am 10 Dez. 2016

Kommentiert:

am 10 Dez. 2016

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by