Error in Contour Plotting
Show older comments
I am trying to plot a contour plot with the data exported from some other simulator. I have written the following code but on execution I am getting an error. I am also including the data set file from where I am trying to create the contour plot.
Code:
clear all
close all
clc
load('v_f_100nm_0_00.mat');
x2 = linspace(min(charge.x),max(charge.x),436);
z2 = linspace(min(charge.z),max(charge.z),436);
[X,Z] = meshgrid(charge.z,charge.x);
[X2,Z2] = meshgrid(z2,x2);
n2 = interp2(X,Z,charge.n,X2,Z2);
% transpose matrix
n3 = n2.';
imagesc(x2,z2,n3);
colorbar;
set(gca,'Xlim',[min(charge.x),max(charge.x)]);
set(gca,'Ylim',[min(charge.z),max(charge.z)]);
set(gca,'YDir','normal');
Error Information:
Error using griddedInterpolant
The number of input coordinate arrays does not equal the number of dimensions (NDIMS) of these arrays.
Error in interp2>makegriddedinterp (line 228)
F = griddedInterpolant(varargin{:});
Error in interp2 (line 136)
F = makegriddedinterp(X, Y, V, method,extrap);
Error in matlab_code_charge_polt (line 18)
n2 = interp2(X,Z,charge.n,X2,Z2);
Kindly help to resolve the issue. Actually I am not getting the error caused by the command, "interp2".
Answers (0)
Categories
Find more on Contour Plots in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!