Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Matlab - RCS calculation surf function

Status
Not open for further replies.

fabibzh

Newbie level 3
Joined
Mar 8, 2016
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
21
Hello,

I am calculating Radar Cross Section with matlab. My results are correct, i want to plot these results.
I have 2 input variables.
I use the "surf" function.
Following RCS values, i want to color the curve. For example, for RCS = -5 to -2, the curve will be yellow, for RCS = 10 to 20, orange, ... I don't know how to do it. :bang::bang:
Can you help me ?

rcs.PNG
 

On the Mathworks page I have found the following:
surf(Z,C) plots the height of Z, a single-valued function defined over a geometrically rectangular grid, and uses matrix C, assumed to be the same size as Z, to color the surface. See Coloring Mesh and Surface Plots for information on defining C.

And this is the page where they talk about coloring the surface. **broken link removed**
 

Thank you for your answer.
I have only values that interest me.
Now i am trying to color the curve in different part.
ex : color 1 : values between -5 and -3
color 2 : values between 3 and 5
color 3 ...
I want to keep the surf function for the curve.
 

I use the surf function to display values. I want to assign colors to the curve in function of range of values. I am not sur if i had to use colormap with conditions.
 

You can assign the "C" matrix the values you want.

This is a MATLAB script assigning red,green and blue.

Code:
clear
clc

A=ones(25,25);%create a simple matrix with the dimension required (mXn)

%Here, start changing the matrix C1 as you wish
C1 = zeros(size(A));  % filling First RGB table
for row=1:12
    for column=1:12
        C1(row,column)=1;
    end
end

for row=13:17
    for column=13:17
        C1(row,column)=0;
    end
end

for row=18:25
    for column=18:25
        C1(row,column)=0;
    end
end    

C2 = zeros(size(A));    % filling Second RGB table
for row=1:12
    for column=1:12
        C2(row,column)=0;
    end
end

for row=13:17
    for column=13:17
        C2(row,column)=1;
    end
end

for row=18:25
    for column=18:25
        C2(row,column)=0;
    end
end    

C3 = zeros(size(A));    % filling Third RGB table
for row=1:12
    for column=1:12
        C3(row,column)=0;
    end
end

for row=13:17
    for column=13:17
        C3(row,column)=0;
    end
end

for row=18:25
    for column=18:25
        C3(row,column)=1;
    end
end    

%Define the 3 RGB tables with C1,C2,C3
C(:,:,1)=C1;
C(:,:,2)=C2;
C(:,:,3)=C3;

Z = peaks(25); 
surf(Z,C)
title('EXAMPLE')

And here is its plot. You can do better, but you got my point.


You have to assign in each RGB table the value you want.
I have made this:
  • rows 0 to 12 and columns 0 to 12 --> asign RED which means in table one is 1, in table 2 is 0 and in table 3 is 0
  • rows 13 to 17 and columns 13 to 17 --> asign GREEN which means in table one is 0, in table 2 is 1 and in table 3 is 0
  • rows 18 to 25 and columns 18 to 25 --> asign BLUE which means in table one is 0, in table 2 is 0 and in table 3 is 1

So it would be like this:

Color<--->Table 1<--->Table 2<--->Table 3

RED<--->1<--->0<--->0
GREEN<--->0<--->1<--->0
BLUE<--->0<--->0<--->1
 
Last edited:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top