How to plot for this function?

조회 수: 1 (최근 30일)
soe min aung
soe min aung 2021년 1월 22일
댓글: soe min aung 2021년 1월 22일
clear all
close all
clc
x = 0:100;
y = linspace(50,150,101)
[X,Y] = meshgrid(x,y);
f = cos((pi.*x)./50).*sin((pi.*y)./100);
surf(X,Y,f)

채택된 답변

Rik
Rik 2021년 1월 22일
편집: Rik 2021년 1월 22일
You forgot to use the variables you just created:
x = 0:100;
y = linspace(50,150,101);
[X,Y] = meshgrid(x,y);
f = cos((pi.*X)./50).*sin((pi.*Y)./100);
% ^ not x, but X ^ not y, but Y
surf(X,Y,f)
You should also avoid the habit of starting your code with clear all,close all,clc. Especially that first one should be avoided. During debugging you can use clear or clearvars to remove variables, otherwise use functions.
  댓글 수: 1
soe min aung
soe min aung 2021년 1월 22일
Thank you so much...sir

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Environment and Settings에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by