i have create a figure like circle

2 次查看(过去 30 天)
i have to create a figure like this picture. Given value is r= 262pixel, Wmax= 10.6pi , equation is w=Wmax*(1-(x^2+y^2)/(r^2))^2 , x and y are two variables, we cannot know their values.x and y are satisfied the following condition:
sqrt(x^2+y^2)<=r.
i did code this one . but this isn't working. plz anyone help me what is the wrong here. i will be greatful to you.
clear all
format long
r=262;
Wmax=10.6*pi;
syms x y;
xlabel('x')
ylabel('y')
if sqrt(x^2+y^2)>=r
w=0;
elseif sqrt(x^2+y^2)<r
w=Wmax*(1-(x^2+y^2)/r^2)^2;
end
plot(w)

采纳的回答

DGM
DGM 2022-5-25
Try something like this.
% parameters
rmax = 262;
Wmax= 10.6*pi;
% create values
x = -rmax:rmax;
y = x.';
rsq = (x.^2 + y.^2);
w = Wmax*(1-rsq/(rmax^2)).^2;
% truncate background
mk = rsq > rmax^2;
w(mk) = 0;
% show result
imshow(w,[])
  2 个评论
Rezaul hasan
Rezaul hasan 2022-5-25
thanks for answering. can you plz use this eqaution 1-cosw . after using your code, which one you just gave. you will get graph like this. plz send the code after finding graphs.
DGM
DGM 2022-5-25
You mean this?
% parameters
rmax = 262;
Wmax= 10.6*pi;
% create values
x = -rmax:rmax;
y = x.';
rsq = (x.^2 + y.^2);
w = Wmax*(1-rsq/(rmax^2)).^2;
w = 1-cos(w);
% truncate background
mk = rsq > rmax^2;
w(mk) = 0;
% show result
imshow(w,[])

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Data Type Identification 的更多信息

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by