please help me solve this and also tell me what i did wrong m=2x^3-2y-sqrt(x-y^3)/(1+(x-y)/(x^2+3))+sin(x/y*pi)+exp^(y/3)
1 次查看(过去 30 天)
显示 更早的评论
m = 2*x.^3-2*y-sqrt(x-y.^3)./(1+(x-y)./(x.^2+3))+sin(x./y*pi)+exp(y/3)
回答(1 个)
Image Analyst
2021-9-15
Easy enough to type out, but so what. What do you want to do with m? Show it as an image or a surface or something? What range do you want for x and y?
% Demo by Image Analyst
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
clear; % Erase all existing variables. Or clearvars if you want.
workspace; % Make sure the workspace panel is showing.
format short g;
format compact;
fontSize = 20;
numPoints = 500;
xlin = linspace(-5, 5, numPoints);
ylin = linspace(-8, 8, numPoints);
[x, y] = meshgrid(xlin, ylin);
m = 2*x.^3-2*y-sqrt(x-y.^3)./(1+(x-y)./(x.^2+3))+sin(x./y*pi)+exp(y/3);
m = real(m);
% show as an image.
subplot(2, 1, 1);
imshow(m, []);
axis('on', 'image');
xlabel('x', 'FontSize', fontSize);
ylabel('y', 'FontSize', fontSize);
colorbar;
% Show as a surface
subplot(2, 1, 2);
surf(x, y, m, 'EdgeColor', 'none');
xlabel('x', 'FontSize', fontSize);
ylabel('y', 'FontSize', fontSize);
zlabel('m', 'FontSize', fontSize);
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!