【无标题】

✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信。

🍎个人主页:Matlab科研工作室

🍊个人信条:格物致知。

更多Matlab仿真内容点击👇

智能优化算法  神经网络预测 雷达通信  无线传感器

信号处理 图像处理 路径规划 元胞自动机 无人机  电力系统

⛄ 内容介绍

​本文建立了基于 MATLAB 的预警雷达探测模型, 根据雷达和目标的运动参数和雷达系统参数, 模拟和动态显示预警雷达的探测性能; 并对其探测性能进行仿真验证.研究表明, 该方法能够有效仿真预警雷达的探测性能,具有良好的人机交互动态可视化功能.

⛄ 部分代码

else

    sensorIDs = cellfun(@(d)d.SensorIndex,dets);

end

numDets = numel(sensorIDs);

iPlats = zeros(numDets,1);

uSensorIDs = unique(sensorIDs);

iSensorPlats = findPlatforms(scene);

for m = 1:numel(uSensorIDs)

    thisID = uSensorIDs(m);

    

    usePlatIdx = -1;

    for k = 1:numel(iSensorPlats)

        idxPlat = iSensorPlats(k);

        thisPlat = scene.Platforms{idxPlat};

        foundSensor = false;

        for j = 1:numel(thisPlat.Sensors)

            thisSensor = thisPlat.Sensors{j};

            if thisSensor.SensorIndex == thisID

                foundSensor = true;

                break

            end

        end

        if foundSensor

            usePlatIdx = idxPlat;

            break

        end

    end

    

    if usePlatIdx>0

        iFnd = sensorIDs == thisID;

        iPlats(iFnd) = usePlatIdx;

    end

end

end

function [str,type] = platformName(~)

str = 'Tower';

type = 'DisplayName';

end

function [str,type] = detectionsName(~)

str = 'Radar detections';

type = 'DisplayName';

end

function val = localGetVal(thing, idx)

% Indexing that supports either cell or non-cell arrays

if iscell(thing)

    val = thing{idx};

else

    val = thing(idx);

end

end

function flag = isPublishing()

% Returns true when MATLAB is publishing

flag = ~isempty(snapnow('get'));

end

function writeAnimatedGIF(fname, frames, numFrames, rate, loopCount)

dt = 1/rate;

if isstruct(frames)

    % pFrames is set to getframe(h) frames

    for m = 1:numFrames

        im = frame2im(frames(m));

        [A,map] = rgb2ind(im,256);

        if m == 1

            imwrite(A,map,fname,'gif','LoopCount',loopCount,'DelayTime',dt);

        else

            imwrite(A,map,fname,'gif','WriteMode','append','DelayTime',dt);

        end

    end

else

    % pFrames is set to RGB images such as are returned

    % by print('-RGBImage','-opengl','-r0')

    for m = 1:numFrames

        im = frames(:,:,:,m);

        [A,map] = rgb2ind(im,256);

        if m == 1

            imwrite(A,map,fname,'gif','LoopCount',loopCount,'DelayTime',dt);

        else

            imwrite(A,map,fname,'gif','WriteMode','append','DelayTime',dt);

        end

    end

end

end

function localWriteVideo(fname, frames, numFrames, rate, profile)

vid = VideoWriter(fname,profile);

vid.FrameRate = rate;

open(vid);

if isstruct(frames)

    % pFrames is set to getframe(h) frames

    for m = 1:numFrames

        writeVideo(vid,frames(m));

    end

else

    % pFrames is set to RGB images such as are returned

    % by print('-RGBImage','-opengl','-r0')

    writeVideo(vid,frames(:,:,:,1:numFrames));

end

close(vid);

end

function [clrs,comps] = getColors(nClrs)

% Compute a set of unique colors whose complementary colors will also be

% unique colors

hsv = ones(nClrs,3);

hsv(:,3) = 1;

tmp = linspace(0,0.45,nClrs+1);

hsv(:,1) = tmp(1:nClrs);

clrs = hsv2rgb(hsv);

if nargout>1

    comps = getComplementaryColors(clrs);

end

end

function comps = getComplementaryColors(clrs)

% Compute complementary colors from set of colors

hsv = rgb2hsv(clrs);

hsv(:,1) = mod(hsv(:,1)+0.5,1);

comps = hsv2rgb(hsv);

end

function txSig = findEmittingSignal(thisSig,signals)

isTx = isTXSignals(signals);

txSignals = signals(isTx);

numTx = numel(txSignals);

txPos = zeros(3,numTx);

txVel = zeros(3,numTx);

for m = 1:numTx

    txPos(:,m) = txSignals(m).OriginPosition;

    txVel(:,m) = txSignals(m).OriginVelocity;

end

txDir = thisSig.OriginPosition(:)-txPos;

relVel = thisSig.OriginVelocity(:)-txVel;

rgs = sqrt(sum(abs(txDir).^2,1));

txDir = txDir./rgs;

rrs = dot(relVel,txDir,1);

errRg = rgs-thisSig.PropagationRange;

errRR = rrs-thisSig.PropagationRangeRate;

[~,iMin] = min(abs(errRg)+abs(errRR));

txSig = txSignals(iMin);

end

function [thisPlat, thisSystem] = findSystem(plats,type,ID)

thisPlat = [];

thisSystem = [];

if contains('Sensor',type,'IgnoreCase',true)

    propName = 'Sensors';

    idName = 'SensorIndex';

else

    propName = 'Emitters';

    idName = 'EmitterIndex';

end

numPlats = numel(plats);

wasFound = false;

for iPlat = 1:numPlats

    thisPlat = plats{iPlat};

    theseSystems = thisPlat.(propName);

    for iSys = 1:numel(theseSystems)

        thisSystem = theseSystems{iSys};

        if thisSystem.(idName) == ID

            wasFound = true;

            break

        end

    end

    

    if wasFound

        break

    end

end

end

function setupChaseGraphics(hAxes)

% setup axes

hAxes.DataAspectRatio = [1 1 1];

hAxes.Projection = 'perspective';

hAxes.CameraViewAngle = 30;

axis(hAxes,'vis3d');

% axis(hAxes,'off');

% Use camera zoom style

z = zoom(hAxes);

z.setAxes3DPanAndZoomStyle(hAxes,'camera');

shrinkZLimits([], hAxes);

end

function updateChaseCamera(hAxes,plat,system)

% set camera position

dims = plat.Dimensions;

fov = system.FieldOfView;

% get system mounting location and orientation

mntLoc = system.MountingLocation(:);

mntAng = system.MountingAngles;

mntRot = rotmat(quaternion(mntAng,'eulerd','zyx','frame'),'frame');

% get system look angle

lkAng = zeros(1,2); % [az el]

numAng = numel(system.LookAngle);

lkAng(1:numAng) = system.LookAngle;

lkRot = rotmat(quaternion([lkAng(1) -lkAng(2) 0],'eulerd','zyx','frame'),'frame');

R = lkRot*mntRot;

plat = pose(plat);

platRot = plat.Orientation;

if isa(platRot,'quaternion')

    platRot = rotmat(platRot,'frame');

end

R = R*platRot;

T = plat.Position(:)+mntLoc;

viewHt = 3/2 * dims.Height;

viewLoc = [-5/2 * dims.Length 0]';

cp = R'*[viewLoc; viewHt] + T;

% % translate ego mounting orientation it to scenario orientation

% yaw = 0;

% pitch = 0;

% roll = 0;

% cR = R*rotmat(quaternion([yaw pitch roll],'eulerd','zyx','frame'),'frame');

cR = R;

ct = cR(1,:)' + cp;

cu = cR(3,:)';

% hAxes.CameraPosition = cp;

% hAxes.CameraTarget = ct;

% hAxes.CameraUpVector = -cu;

% set(hAxes, ...

%     'DataAspectRatio', [1 1 1], ...

%     'Projection', 'perspective', ...

%     'CameraViewAngle', fov(1));

set(hAxes,  'CameraPosition', cp, ...

    'CameraTarget', ct, ...

    'CameraUpVector', -cu, ...

    'DataAspectRatio', [1 1 1], ...

    'Projection', 'perspective', ...

    'CameraViewAngle', fov(1));

end

function shrinkZLimits(rt, hAxes)

set(hAxes, ...

    'XLimMode','auto', ...

    'YLimMode','auto', ...

    'ZLimMode','auto', ...

    'CameraPositionMode','auto', ...

    'CameraTargetMode','auto', ...

    'CameraUpVectorMode','auto', ...

    'CameraViewAngleMode','auto');

% keep z limits within 10 m of vertical range of all road tiles

if ~isempty(rt)

    minZ = Inf;

    maxZ = -Inf;

    

    for iTile=1:numel(rt)

        if rt(iTile).TileID>0

            minZi = min(rt(iTile).Vertices(:,3));

            maxZi = max(rt(iTile).Vertices(:,3));

            minZ = min(minZi, minZ);

            maxZ = max(maxZi, maxZ);

        end

    end

    camP = hAxes.CameraPosition;

    camT = hAxes.CameraTarget;

    camU = hAxes.CameraUpVector;

    hAxes.DataAspectRatio = [1 1 1];

    xLim = hAxes.XLim;

    yLim = hAxes.YLim;

    set(hAxes,'XLim',xLim,'YLim',yLim,'ZLim',10*[minZ/10 1+floor(maxZ/10)], ...

        'CameraPosition',camP,'CameraTarget',camT,'CameraUpVector',camU);

    view(hAxes, -90,90);

end

end

function dur = sceneDuration(scene)

dur = inf;

for iPlat = 1:numel(scene.Platforms)

    traj = scene.Platforms{iPlat}.Trajectory;

    if isa(traj,'waypointTrajectory')

        dur = min(max(traj.TimeOfArrival),dur);

    end

end

end

function hfig = createFigure()

hfig = figure;

scale = 0.5;

pos = hfig.Position;

width = pos(3);

height = pos(4);

adjWidth = scale*width;

adjHeight = scale*height;

hfig.Position = pos+[-adjWidth/2 -adjHeight adjWidth adjHeight];

hfig.Units = 'normalized';

end

⛄ 运行结果

⛄ 参考文献

[1]熊军, 行小帅, 张清泉,等. 基于MATLAB的雷达目标测量仿真分析[J]. 海南师范大学学报:自然科学版, 2014, 27(3):4.

⛄ Matlab代码关注

❤️部分理论引用网络文献,若有侵权联系博主删除

❤️ 关注我领取海量matlab电子书和数学建模资料

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

matlab科研助手

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值