Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7407831
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:47:52+00:00 2026-05-29T05:47:52+00:00

I am working with some matlab code that processes data (in a Kalman Filter)

  • 0

I am working with some matlab code that processes data (in a Kalman Filter) and creates a series of contour plots. It has been running on a RHEL 4 server in matlab 2006a for a few years, but my boss recently requested that all servers be updated to RHEL 6…and at least matlab 2007a. I have worked out all the depreciations between these versions, but I am still having one major problem.

The code that creates and prints different contour plots is working for whichever of the three plots is created first. It looks like this:
enter image description here

Unfortunately the next two plots look like this:

enter image description here

The three figures are plotted independently in separate functions and I use clf("reset"); before and after creating each figure. Each function works in and of itself, but when all three are plotted the second and third figures are all messed up. Has anyone else had this problem? Here is the code that creates one of the figures.

function Crd = TEC_plot(ITEC,RT,Param,Input,t,OutPath,RxExtAll,Time)
% Generate TEC plot 
    Function_for_Spline_Smoothing = [.05 .1 .05; .1 .4 .1; .05 .1 .05];
    ITEC = conv2(ITEC,Function_for_Spline_Smoothing,'same'); % add more of these lines to make contours smoother
    ITEC = conv2(ITEC,Function_for_Spline_Smoothing,'same'); % add more of these lines to make contours smoother
%   ITEC = conv2(ITEC,Function_for_Spline_Smoothing,'same'); % add more of these lines to make contours smoother
%   ITEC = conv2(ITEC,Function_for_Spline_Smoothing,'same'); % add more of these lines to make contours smoother

    earth('CAMERA',RT.Camera,'FIG',1);
    figure;
    warning off; hold on;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Changed 13 February 2007 to make plots prettier
    thinning_scale=2; % (1 to 10) increase this value to thin the density of the contour number labels
    [cscale,hgt]=m_contour(Param.Grid.LonAxis,Param.Grid.LatAxis,ITEC, ...
       round(RT.Levels(1:thinning_scale:end)/5)*5);
    hold on
    m_contourf(Param.Grid.LonAxis,Param.Grid.LatAxis,ITEC,RT.Levels);
    shading flat

    m_coast('line','color','y','LineWidth',1); 

    clabel(cscale,hgt,'labelspacing',72,'rotation',0,'fontsize',10 ...
                      ,'FontAngle','italic','color','w');
    axis([-.65 .6 .25 1.32])    % hardwiring axis length since the coastline runs off of the plot
% Changed 13 February 2007
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% %-------------------- to include different station markers for different sources -------------------
    if ~isempty(Input.Data) % Plot receivers used in this inversion

        Crd=uniquerows(double(cat(1,RxExtAll)));
        RxType=round(Crd(:,4));
        Crd=cartsph(Crd)*180/pi;

        i1 = find( (Crd(:,3) > RT.Camera(3)).*(Crd(:,3) < RT.Camera(4)).*...
                  (Crd(:,2) > RT.Camera(1)).*(Crd(:,2) < RT.Camera(2)).*...
                  (RxType==1) );

        i2 = find( (Crd(:,3) > RT.Camera(3)).*(Crd(:,3) < RT.Camera(4)).*...
                  (Crd(:,2) > RT.Camera(1)).*(Crd(:,2) < RT.Camera(2)).*...
                  (RxType==2) );

        i3 = find( (Crd(:,3) > RT.Camera(3)).*(Crd(:,3) < RT.Camera(4)).*...
                  (Crd(:,2) > RT.Camera(1)).*(Crd(:,2) < RT.Camera(2)).*...
                  (RxType==3) );

        m_plot(Crd(i1,3),Crd(i1,2),'ro','markersize',5,'LineWidth',2);
%       m_plot(Crd(i1,3),Crd(i1,2),'r.','markersize',6,'LineWidth',2);
        m_plot(Crd(i2,3),Crd(i2,2),'r^','markersize',5,'LineWidth',2);
%       m_plot(Crd(i2,3),Crd(i2,2),'r.','markersize',6,'LineWidth',2);
        m_plot(Crd(i3,3),Crd(i3,2),'rp','markersize',5,'LineWidth',2);

        plot(-.6,.45,'ro','markersize',5,'LineWidth',2);text(-.55,.45,'CORS','Color','k')
        plot(-.6,.39,'r^','markersize',5,'LineWidth',2);text(-.55,.39,'GPS/Met','Color','k')
        plot(-.6,.33,'rp','markersize',5,'LineWidth',2);text(-.55,.33,'RTIGS','Color','k')

    end
% % ------------------------------------------------------------------------------- 

    hold off; warning on;axis off;

%   caxis([RT.Levels(1),(RT.Levels(length(RT.Levels)))/2]); colorbar('vert');  %Color bar from 0 to 50 --- for Low Solar Activity
    caxis([RT.Levels(1),(RT.Levels(length(RT.Levels)))]); colorbar('vert');  %Color bar from 0 to 100 --- for High Solar Activity

    title(sprintf('Total Electron Content Units x 10^1^6 m^-^2'),'Fontsize',11)
    if size(Crd,1)==0,
        title(sprintf('Total Electron Content Units x 10^1^6 m^-^2 Caution: No Data Available, IRI95 Only'),'Fontsize',10)
    end
    whitebg('w')
    text(-0.6,0.22,sprintf('%s from %s to %s UT           NOAA/SWPC Boulder, CO USA (op.ver. 1.0)',datestr(Time(t)+1E-8,1),datestr(Time(t)+1E-8,15),datestr(Time(t)+1E-7+15/1440,15)),'Fontsize',11)
    whitebg('w')

% This option print to a file
%        set(gcf, 'Position', [0,0,1950,1467]);
%        print('-f1','-dpng','-painters',filename([OutPath,'{YYYY}{MM}{DD}{HRMN}_TEC'],Time(t)));
%        system(['convert ', filename([OutPath,'{YYYY}{MM}{DD}{HRMN}_TEC.png'],Time(t)),' -scale 650x489 ',' -colors 256 ', filename([OutPath,'{YYYY}{MM}{DD}{HRMN}_TEC.png'],Time(t))]);


% Printing a postscript file because requirements for the automatic reboot
    print('-f1','-dpsc','-r1000','-painters', filename([OutPath,'{YYYY}{MM}{DD}{HRMN}_TEC'],Time(t)));

% Convert the postscript file to jpg using ghostscripts
    system(['gs -q -dBATCH -dNOPAUSE -r300 -sDEVICE=jpeg -sOutputFile=',filename([OutPath,'{YYYY}{MM}{DD}{HRMN}_TEC.jpg'],Time(t)),' ', filename([OutPath,'{YYYY}{MM}{DD}{HRMN}_TEC.ps'],Time(t))]);
% Converting from jpg to png and reducing the size of the figure.
    system(['convert ',filename([OutPath,'{YYYY}{MM}{DD}{HRMN}_TEC.jpg'],Time(t)),' -crop 2050x1675+325+775 ',' -scale 650x489 ',' -colors 256 ', filename([OutPath,'{YYYY}{MM}{DD}{HRMN}_TEC.png'],Time(t))]);
% Removing the jpg and ps files (ask Cliff how can we put both files in just one command)
    %system(['rm ',filename([OutPath,'*.jpg'],Time(t))]);
    %system(['rm ',filename([OutPath,'*.ps'],Time(t))]); 
end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T05:47:52+00:00Added an answer on May 29, 2026 at 5:47 am

    Try to not use clf which will clear your whole figure but use the figure in between to open three independant figures. See it it’ll work 🙂

    Edit: That’s just guessing without actually seeing your code

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been working on some legacy C++ code that uses variable length structures
I have some working code that does amplitude modulation and plots it. However I'm
I have some MATLAB code I've been working with. There are three sections, say
I'm working on some code that uses the System.Diagnostics.Trace class and I'm wondering how
I'm working with some code that is confusing me and I'm wondering if I'm
Working on some code today, I found that the following would work in 5.3,
I am working on some fourier transform code in matlab, and have come across
I have been working for two years in software industry. Some things that have
I have been working with some friends to convert a Matlab Genetic Algorithm to
I have some working code that I altered but I can't seem to get

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.