The surface Z must contain more than one row or column.
1 view (last 30 days)
Show older comments
Hi, I am pretty new to matlab and am trying to graph series using complex variables. I don't understand why I keep getting this error on line 16. Here is the code:
figure;
figure;
p=2; %range and domain of the graph
a=-p:0.1:p;
b=-p:0.1:p;
[A,B]=meshgrid(a,b);
x=(A+1i*B); %splitting the input into real and imaginary parts
C=real(summation(x));%the real part of the output
D=imag(summation(x));%the imaginary part of the output
t=surfc(A,B,C,D);%graphs the funtion. D is the colour gradient showing the imaginary output
function y = summation(x);
y =complex(zeros(41))
n=2;
for k=1:n;
f= x.^k;
end
y=sum(f)
end
Thanks in advance!
0 Comments
Answers (1)
KALYAN ACHARJYA
on 19 Nov 2019
Edited: KALYAN ACHARJYA
on 19 Nov 2019
Is this? Please make C and D vectors with same girds points
p=2; %range and domain of the graph
a=-p:0.1:p;
b=-p:0.1:p;
[A,B]=meshgrid(a,b);
x=(A+1i*B); %splitting the input into real and imaginary parts
C=real(summation(x));%the real part of the output
D=imag(summation(x));%the imaginary part of the output
[C,D]=meshgrid(C,D);
t=surfc(A,B,C,D);%graphs the funtion. D is the colour gradient showing the imaginary output
I didnot check the role of function file.
Hope it Helps!
0 Comments
See Also
Categories
Find more on Environment and Settings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!