Effacer les filtres
Effacer les filtres

How to plot for this function?

1 vue (au cours des 30 derniers jours)
soe min aung
soe min aung le 22 Jan 2021
Commenté : soe min aung le 22 Jan 2021
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)

Réponse acceptée

Rik
Rik le 22 Jan 2021
Modifié(e) : Rik le 22 Jan 2021
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 commentaire
soe min aung
soe min aung le 22 Jan 2021
Thank you so much...sir

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Environment and Settings dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by