kk1
function kk1
clc;clear;close all;
l=633;
c = 1;
k0=2*pi/l;
ea=1.39;
da=1:300;
theta=1:70;
y=zeros(length(theta),length(da));
np=1.5;
x=(2*pi/l)*np*sind(theta);
function y=f(theta,da)
for i=1:length(theta)
iter = 0;
for j=1:length(da)
iter
ka=k0*sqrt(ea-x.^2);
f=(1-exp(2*1i.*da(j).*ka(i)))/(1+exp(2*1i.*da(j).*ka(i)));
%pfms=2*atan(1i*a.*b);
y(i,j)=2*atan(1i*c.*f);
% disp(y);
iter = iter + 1;
end
end
end
plot(da,y )
end
why this is not working how to make looping in function and find its derivative w r to da i.e df/dda with out syms and help to plot any one

6 件のコメント

Matt J
Matt J 2022 年 1 月 29 日
In what way are we to see that it isn't working?
shiv gaur
shiv gaur 2022 年 1 月 29 日
not plot any thing
Cris LaPierre
Cris LaPierre 2022 年 1 月 29 日
Sure it does. It's plotting exactly what you are telling it to plot: (da,y)
David Hill
David Hill 2022 年 1 月 29 日
You never call your function f. What computation are you trying to do? Your code makes no sense.
shiv gaur
shiv gaur 2022 年 1 月 29 日
編集済み: Cris LaPierre 2022 年 1 月 29 日
other type with out function showing some value given in fig
why is so
% Edit - easier to view the fig here than download it
openfig('fig.fig');
Cris LaPierre
Cris LaPierre 2022 年 1 月 29 日
You never call (run) your function.

サインインしてコメントする。

 採用された回答

Voss
Voss 2022 年 1 月 29 日

0 投票

You must call the function f() somwhere. Your code defined f() but never used it; that's why there was an empty plot: y was not updated.
kk1(); % here I am calling your main function kk1
Warning: Imaginary parts of complex X and/or Y arguments ignored.
function kk1
clc;clear;close all;
l=633;
c = 1;
k0=2*pi/l;
ea=1.39;
da=1:300;
theta=1:70;
% y=zeros(length(theta),length(da));
np=1.5;
x=(2*pi/l)*np*sind(theta);
y = f(theta,da); % here your main function kk1 is calling the nested function f
plot(da,y);
function y=f(theta,da)
y=zeros(length(theta),length(da));
for i=1:length(theta)
iter = 0;
for j=1:length(da)
% iter
ka=k0*sqrt(ea-x.^2);
f=(1-exp(2*1i.*da(j).*ka(i)))/(1+exp(2*1i.*da(j).*ka(i)));
%pfms=2*atan(1i*a.*b);
y(i,j)=2*atan(1i*c.*f);
% disp(y);
iter = iter + 1;
end
end
end
end

1 件のコメント

shiv gaur
shiv gaur 2022 年 1 月 29 日
pl plot between da vs dy/dda pl help

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMATLAB についてさらに検索

製品

リリース

R2021b

タグ

質問済み:

2022 年 1 月 29 日

コメント済み:

2022 年 1 月 29 日

Community Treasure Hunt

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

Start Hunting!

Translated by