简体   繁体   English

Matlab无法使用“ surf”命令绘制3D图形

[英]Matlab cannot plot the 3D graph using “surf” command

Matlab cannot give the 3d surface plot of the following program.Matlab gives the value of all the variables in matrix form. Matlab无法提供以下程序的3d表面图.Matlab以矩阵形式给出所有变量的值。 But it cacnot plot the 3d graph using surf command. 但是它使用surf命令无法绘制3d图形。 Why matlab cannot plot a 3d graph using 'surf' command in symbolic variable?? 为什么Matlab无法在符号变量中使用'surf'命令绘制3D图形? pls help me.... 请帮助我....

clear all
close all
clc
syms r
c=1;
for R=0.01:0.01:0.03
    R1(c)=R;
    j=1;
    for l=0.3:0.01:0.4
        l1(j)=l;
        A=l*exp(-r^2);
        B=int(A,0,inf);
        B1(c,j)=B;
        j=j+1;
    end
    c=c+1;
end
B1=real(B1)
surf(R1,l1,B1')

You just need to add these three lines after the last end : 您只需要在最后end之后添加以下三行:

B1=double(B1)               % Converts from symbolic to numerical
[X ,Y]=meshgrid(R1,l1);     % Creates a grid that is R1,l1 size, repeated
surf(R1,l1,B1')             % plot!

在此输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM