Hello, I have been reading through the manuals, but unfortunately since I am also not a Matlab user I ran into some problems. I am not a programmer so if my questions are stupid, please bear with me. I am using an optical program for simulations. The university that I am working with have written a bunch of simple programs in Matlab for visualization. I used the matlab2scilab conversion program, but it appears quite a bit does not translate on the following: I have tried various things and I was wondering if someone could clarify the correct syntax to use. File 1 and File 2 are calculated from the optical program and are binary files.
Questions:
1) Is draw2d the correct plot program for this data? What is being plotted is a time average intensity of two different times versus the X position. In other words the x position is in relation to the x distance and the y distance is the average intensity at two different times t and t'. The intensity is plotted at the same y position as the physical dimension of either the quartz or air.
2) Should I use c-axis for both the x and y axis? It was not clear in the manuals.
3) I do not know what the colorbar function is in Matlab. I looked at Matlab manuals, but since I do not use the program was not sure what this is.
A little bit of help would go a long way in understanding how to use Scilab and I would appreciate the help.
Thanks,
MunichTexan - an old dog trying to learn new tricks. :-)
more plotam.m
function [a,b,c] = plotam(file1,file2)
% comment
fp1=fopen(file1);
fp2=fopen(file2);
size1=fread(fp1,3,'long');
size2=fread(fp2,3,'long');
if size1(1)==1
nx=size1(2);
ny=size1(3);
xlab='y axis (nodes)';
ylab='z axis (nodes)';
end
if size1(2)==1
nx=size1(1);
ny=size1(3);
xlab='x axis (nodes)';
ylab='z axis (nodes)';
end
if size1(3)==1
nx=size1(1);
ny=size1(2);
xlab='x axis (nodes)';
ylab='y axis (nodes)';
end
a=fread(fp1,[nx ny],'float');
b=fread(fp2,[nx ny],'float');
c=a.*a+b.*b;
pcolor(c');
shading('flat');
caxis([0 2*average(c)]);
%axis('equal');
colormap('hot');
colorbar;
xlabel(xlab);
ylabel(ylab);
title('<|E|^2>');
fclose(fp1);
fclose(fp2);
more plotam.sci
function [a,b,c] = plotam(file1,file2)
// Ouput variables initialisation (not found in input variables)
a=[];
b=[];
c=[];
// Display warning for floating point exception
ieee(1)
// comment
fp1 = fopen(file1);
fp2 = fopen(file2);
// L.5: No simple equivalent, so mtlb_fread() is called
size1 = mtlb_fread(fp1,3,"long");
// L.6: No simple equivalent, so mtlb_fread() is called
size2 = mtlb_fread(fp2,3,"long");
if size1(1)==1 then
nx = size1(2);
ny = size1(3);
xlab = "y axis (nodes)";
ylab = "z axis (nodes)";
end;
if size1(2)==1 then
nx = size1(1);
ny = size1(3);
xlab = "x axis (nodes)";
ylab = "z axis (nodes)";
end;
if size1(3)==1 then
nx = size1(1);
ny = size1(2);
xlab = "x axis (nodes)";
ylab = "y axis (nodes)";
end;
// L.29: No simple equivalent, so mtlb_fread() is called
a = mtlb_fread(fp1,[nx,ny],"float");
// L.30: No simple equivalent, so mtlb_fread() is called
b = mtlb_fread(fp2,[nx,ny],"float");
c = a .*a+b .*b;
// !! L.32: Unknown function pcolor, original calling sequence used
pcolor(c');
// !! L.33: Unknown function shading, original calling sequence used
shading("flat");
// !! L.34: Unknown function average, original calling sequence used
// !! L.34: Unknown function caxis, original calling sequence used
caxis([0,2*mtlb_double(average(c))]);
//axis('equal');
// !! L.36: Unknown function colormap, original calling sequence used
colormap("hot");
// ! L.37: mtlb(colorbar) can be replaced by colorbar() or colorbar whether colorbar is an M-file or not
// !! L.37: Unknown function colorbar, original calling sequence used colorbar;
colorbar;
// !! L.38: Unknown function xlabel, original calling sequence used
xlabel(xlab);
// !! L.39: Unknown function ylabel, original calling sequence used
ylabel(ylab);
// !! L.40: Unknown function title, original calling sequence used
title("<|E|^2>");
mclose(fp1);
mclose(fp2);
endfunction
Last edited by munichtexan; 03-12-2006 at 06:12 PM.
|