Making Matrix dimensions agree
조회 수: 7 (최근 30일)
이전 댓글 표시
I'm attempting to make a surface plot using 101 and 201 data point for the x and y respectively. I've attempted changing the fxy but am having no luck making the dimensions agree. This is what I have below so far. Thank you in advance to anyone that can help.
clearvars
clc
close all
x=-2:0.04:2;
y=-4:0.04:4;
[X,Y] = meshgrid(x,y);
fxy= x.*exp((-x.^2)-(y./2).^2);
surf(X,Y,fxy)
댓글 수: 0
채택된 답변
Stephen23
2022년 10월 5일
x=-2:0.04:2;
y=-4:0.04:4;
[X,Y] = meshgrid(x,y);
fXY = X.*exp((-X.^2)-(Y./2).^2); % use X and Y here, not x and y.
surf(X,Y,fXY)
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!